Add automated filesystem checking based on scripts I've used now for
quite some time locally. Most of the test require root so they are skipped when run without necessarry privelegies.
This commit is contained in:
parent
a8c3e5e3c7
commit
7d44ff7de6
|
|
@ -1,3 +1,9 @@
|
|||
2013-11-19 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Add automated filesystem checking based on scripts I've used now for
|
||||
quite some time locally. Most of the test require root so they are
|
||||
skipped when run without necessarry privelegies.
|
||||
|
||||
2013-11-19 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-install.c (main): Adjust info messages to match
|
||||
|
|
|
|||
|
|
@ -70,6 +70,10 @@ build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/mis
|
|||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
|
||||
CLEANFILES += build-grub-mkfont
|
||||
|
||||
garbage-gen: util/garbage-gen.c
|
||||
$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $^
|
||||
CLEANFILES += garbage-gen
|
||||
|
||||
build-grub-gen-asciih: util/grub-gen-asciih.c
|
||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
|
||||
CLEANFILES += build-grub-gen-asciih
|
||||
|
|
|
|||
|
|
@ -690,6 +690,127 @@ script = {
|
|||
installdir = noinst;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = grub-fs-tester;
|
||||
common = tests/util/grub-fs-tester.in;
|
||||
installdir = noinst;
|
||||
dependencies = garbage-gen;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = ext234_test;
|
||||
common = tests/ext234_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = squashfs_test;
|
||||
common = tests/squashfs_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = iso9660_test;
|
||||
common = tests/iso9660_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = hfsplus_test;
|
||||
common = tests/hfsplus_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = ntfs_test;
|
||||
common = tests/ntfs_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = reiserfs_test;
|
||||
common = tests/reiserfs_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = fat_test;
|
||||
common = tests/fat_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = minixfs_test;
|
||||
common = tests/minixfs_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = xfs_test;
|
||||
common = tests/xfs_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = nilfs2_test;
|
||||
common = tests/nilfs2_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = romfs_test;
|
||||
common = tests/romfs_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = exfat_test;
|
||||
common = tests/exfat_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = tar_test;
|
||||
common = tests/tar_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = udf_test;
|
||||
common = tests/udf_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = hfs_test;
|
||||
common = tests/hfs_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = jfs_test;
|
||||
common = tests/jfs_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = btrfs_test;
|
||||
common = tests/btrfs_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = zfs_test;
|
||||
common = tests/zfs_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = cpio_test;
|
||||
common = tests/cpio_test.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = example_scripted_test;
|
||||
|
|
|
|||
|
|
@ -541,8 +541,8 @@ def script(platform):
|
|||
r += "[+ IF mansection +]" + manpage("grub-mkconfig_lib") + "[+ ENDIF +]"
|
||||
r += "[+ ENDIF +]"
|
||||
|
||||
r += rule("[+ name +]", "$(top_builddir)/config.status " + platform_sources(platform), """
|
||||
(skip=1; for x in $^; do if [ $$skip = 1 ]; then skip=0; else cat "$$x"; fi; done) | $(top_builddir)/config.status --file=$@:-
|
||||
r += rule("[+ name +]", "$(top_builddir)/config.status " + platform_sources(platform) + platform_dependencies(platform), """
|
||||
(for x in """ + platform_sources(platform) + """; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:-
|
||||
chmod a+x [+ name +]
|
||||
""")
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.btrfs >/dev/null 2>&1; then
|
||||
echo "mkfs.btrfs not installed; cannot test btrfs."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" btrfs
|
||||
"@builddir@/grub-fs-tester" btrfs_zlib
|
||||
"@builddir@/grub-fs-tester" btrfs_lzo
|
||||
"@builddir@/grub-fs-tester" btrfs_raid0
|
||||
"@builddir@/grub-fs-tester" btrfs_raid1
|
||||
"@builddir@/grub-fs-tester" btrfs_single
|
||||
"@builddir@/grub-fs-tester" btrfs_raid10
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if ! which cpio >/dev/null 2>&1; then
|
||||
echo "cpio not installed; cannot test cpio."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" cpio_bin
|
||||
"@builddir@/grub-fs-tester" cpio_odc
|
||||
"@builddir@/grub-fs-tester" cpio_newc
|
||||
"@builddir@/grub-fs-tester" cpio_crc
|
||||
"@builddir@/grub-fs-tester" cpio_ustar
|
||||
"@builddir@/grub-fs-tester" cpio_hpbin
|
||||
"@builddir@/grub-fs-tester" cpio_hpodc
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.exfat >/dev/null 2>&1; then
|
||||
echo "mkfs.exfat not installed; cannot test exFAT."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" exfat
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.ext2 >/dev/null 2>&1; then
|
||||
echo "mkfs.ext2 not installed; cannot test ext2."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.ext3 >/dev/null 2>&1; then
|
||||
echo "mkfs.ext3 not installed; cannot test ext3."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.ext4 >/dev/null 2>&1; then
|
||||
echo "mkfs.ext4 not installed; cannot test ext4."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" ext2_old
|
||||
"@builddir@/grub-fs-tester" ext2
|
||||
"@builddir@/grub-fs-tester" ext3
|
||||
"@builddir@/grub-fs-tester" ext4
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.vfat >/dev/null 2>&1; then
|
||||
echo "mkfs.vfat not installed; cannot test FAT."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" vfat16a
|
||||
"@builddir@/grub-fs-tester" vfat12a
|
||||
"@builddir@/grub-fs-tester" vfat12
|
||||
"@builddir@/grub-fs-tester" vfat16
|
||||
"@builddir@/grub-fs-tester" vfat32
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.hfs >/dev/null 2>&1; then
|
||||
echo "mkfs.hfs not installed; cannot test HFS."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! modprobe mac-roman; then
|
||||
echo "no mac-roman support; cannot test HFS."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" hfs
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.hfsplus >/dev/null 2>&1; then
|
||||
echo "mkfs.hfsplus not installed; cannot test hfsplus."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" hfsplus
|
||||
"@builddir@/grub-fs-tester" hfsplus_casesens
|
||||
"@builddir@/grub-fs-tester" hfsplus_wrap
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if ! which xorriso >/dev/null 2>&1; then
|
||||
echo "xorriso not installed; cannot test iso9660."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" joliet
|
||||
"@builddir@/grub-fs-tester" rockridge
|
||||
"@builddir@/grub-fs-tester" rockridge_joliet
|
||||
"@builddir@/grub-fs-tester" joliet_1999
|
||||
"@builddir@/grub-fs-tester" rockridge_1999
|
||||
"@builddir@/grub-fs-tester" rockridge_joliet_1999
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.jfs >/dev/null 2>&1; then
|
||||
echo "mkfs.jfs not installed; cannot test JFS."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" jfs
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.minix >/dev/null 2>&1; then
|
||||
echo "mkfs.minix not installed; cannot test minixfs."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! mkfs.minix -h | grep -- -v > /dev/null; then
|
||||
echo "mkfs.minix doesn't support minix3fs; cannot test minix*fs."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" minix
|
||||
"@builddir@/grub-fs-tester" minix2
|
||||
"@builddir@/grub-fs-tester" minix3
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.nilfs2 >/dev/null 2>&1; then
|
||||
echo "mkfs.nilfs2 not installed; cannot test nilfs2."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" nilfs2
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.ntfs >/dev/null 2>&1; then
|
||||
echo "mkfs.ntfs not installed; cannot test ntfs."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" ntfs
|
||||
"@builddir@/grub-fs-tester" ntfscomp
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.reiserfs >/dev/null 2>&1; then
|
||||
echo "mkfs.reiserfs not installed; cannot test reiserfs."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" reiserfs
|
||||
"@builddir@/grub-fs-tester" reiserfs_old
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if ! which genromfs >/dev/null 2>&1; then
|
||||
echo "genromfs not installed; cannot test romfs."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" romfs
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if ! which mksquashfs >/dev/null 2>&1; then
|
||||
echo "mksquashfs not installed; cannot test squashfs."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" squash4_gzip
|
||||
"@builddir@/grub-fs-tester" squash4_xz
|
||||
"@builddir@/grub-fs-tester" squash4_lzo
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if ! which tar >/dev/null 2>&1; then
|
||||
echo "tar not installed; cannot test tar."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" tarfs
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkudffs >/dev/null 2>&1; then
|
||||
echo "mkudffs not installed; cannot test UDF."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" udf
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which mkfs.xfs >/dev/null 2>&1; then
|
||||
echo "mkfs.xfs not installed; cannot test xfs."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
|
||||
"@builddir@/grub-fs-tester" xfs
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
fi
|
||||
|
||||
if [ "$EUID" != 0 ] ; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! which zpool >/dev/null 2>&1; then
|
||||
echo "zpool not installed; cannot test zfs."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
"@builddir@/grub-fs-tester" zfs
|
||||
"@builddir@/grub-fs-tester" zfs_lzjb
|
||||
"@builddir@/grub-fs-tester" zfs_gzip
|
||||
"@builddir@/grub-fs-tester" zfs_zle
|
||||
"@builddir@/grub-fs-tester" zfs_raidz3
|
||||
"@builddir@/grub-fs-tester" zfs_raidz2
|
||||
"@builddir@/grub-fs-tester" zfs_raidz
|
||||
"@builddir@/grub-fs-tester" zfs_mirror
|
||||
"@builddir@/grub-fs-tester" zfs_stripe
|
||||
"@builddir@/grub-fs-tester" zfs_caseins
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Standard random generator is slow. For FS testing we need just some
|
||||
garbage files, we don't need them to be high-quality random.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
static unsigned long long buffer[1048576];
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
unsigned long long high = 0, low = 1;
|
||||
unsigned long i, j;
|
||||
unsigned long long cnt = strtoull (argv[1], 0, 0);
|
||||
struct timeval tv;
|
||||
gettimeofday (&tv, NULL);
|
||||
high = tv.tv_sec;
|
||||
low = tv.tv_usec;
|
||||
if (!high)
|
||||
high = 1;
|
||||
if (!low)
|
||||
low = 2;
|
||||
|
||||
for (j = 0; j < (cnt + sizeof (buffer) - 1) / sizeof (buffer); j++)
|
||||
{
|
||||
for (i = 0; i < sizeof (buffer) / sizeof (buffer[0]); i += 2)
|
||||
{
|
||||
int c1 = 0, c2 = 0;
|
||||
buffer[i] = low;
|
||||
buffer[i+1] = high;
|
||||
if (low & (1ULL << 63))
|
||||
c1 = 1;
|
||||
low <<= 1;
|
||||
if (high & (1ULL << 63))
|
||||
c2 = 1;
|
||||
high = (high << 1) | c1;
|
||||
if (c2)
|
||||
low ^= 0x87;
|
||||
}
|
||||
if (sizeof (buffer) < cnt - sizeof (buffer) * j)
|
||||
fwrite (buffer, 1, sizeof (buffer), stdout);
|
||||
else
|
||||
fwrite (buffer, 1, cnt - sizeof (buffer) * j, stdout);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue