From: Lingzhu Xiang <lxiang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Jeremy Kerr <jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Matt Fleming
<matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>,
Matthew Garrett <mjg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH] selftests: Add tests for efivarfs
Date: Mon, 21 Jan 2013 18:40:30 +0800 [thread overview]
Message-ID: <50FD1B1E.5000208@redhat.com> (raw)
In-Reply-To: <1358500776.780948.518900415126.1.gpush@pecola>
On 01/18/2013 05:19 PM, Jeremy Kerr wrote:
> This change adds a few initial efivarfs tests to the
> tools/testing/selftests directory.
>
Nice idea. I might add a few look test cases or try some fs testsuites
on efivarfs.
> + # the open-unlink test relies on deleting the Lang variable at
> + # present; we don't want to do this on an actual machine.
It seems open-unlink already goes to delete a custom variable.
> + if ! grep -q 'model name.* QEMU' /proc/cpuinfo; then
> + echo $msg efivarfs tests should only be run on a VM >&2
> + exit 0
> + fi
This won't allow me to test. I use qemu-kvm -cpu host, /proc/cpuinfo
doesn't have the string "QEMU".
How about grep -q OVMF /sys/firmware/acpi/tables/DSDT? Or add a prompt
if it can't be determined?
> +# test that we can remove a variable by issuing a write with only
> +# attributes specified
> +test_zero_size_delete()
> +{
> + local attrs='\x07\x00\x00\x00'
> + local file=$efivarfs_mount/test.3-$test_guid
> +
> + printf "$attrs\x00" > $file
> +
> + if [ ! -e $file ]; then
> + echo "$file does not exist" >&2
> + exit 1
> + fi
> +
test_zero_size_delete can't reproduce the file lingering bug on unpatched
3.8-rc4.
A remount is required to reproduce the bug for newly created variable, here:
umount $efivarfs_mount
mount -t efivarfs - $efivarfs_mount
If a variable exists at boot time, then no remount is required. This is why
I choosed RTC-$GUID. With this remount, I can verify the bug is fixed by
efivarfs: Delete dentry from dcache in efivarfs_file_write().
> + /* create a test variable */
> + fd = open(path, O_WRONLY | O_CREAT);
> + if (fd < 0) {
> + perror("open(O_WRONLY)");
> + return EXIT_FAILURE;
> + }
> +
> + rc = write(fd, buf, sizeof(buf));
> + if (rc != sizeof(buf)) {
> + perror("write");
> + return EXIT_FAILURE;
> + }
> +
> + close(fd);
> +
Likewise, we might want to test this with remount after file creation.
> + fd = open(path, O_RDONLY);
> + if (fd < 0) {
> + perror("open");
> + return EXIT_FAILURE;
> + }
--
Lingzhu Xiang
next prev parent reply other threads:[~2013-01-21 10:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-18 9:19 [PATCH] selftests: Add tests for efivarfs Jeremy Kerr
2013-01-21 10:40 ` Lingzhu Xiang [this message]
[not found] ` <50FD1B1E.5000208-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-01-22 4:54 ` Jeremy Kerr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50FD1B1E.5000208@redhat.com \
--to=lxiang-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org \
--cc=mjg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.