]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
tests: generate test_data.tmp file from a script
authorTheodore Ts'o <tytso@mit.edu>
Thu, 3 Jan 2019 19:10:32 +0000 (14:10 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 3 Jan 2019 19:10:32 +0000 (14:10 -0500)
Even if the debugfs executable is not sparse, it might contain a 1k
aligned block which is all zeros, which when written into a 1k block
file system by a test like d_loaddump will result in a sparse file and
causing one or more test failures.

Google-Bug-Id: 122085761
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
tests/Makefile.in
tests/scripts/gen-test-data [new file with mode: 0755]
tests/test_config

index 8c4d204853452f36a8840ae13942bd012f72762f..d9f8c731f7ed28a9b48c757de469265991b0e5a0 100644 (file)
@@ -13,7 +13,7 @@ INSTALL = @INSTALL@
 
 all:: @DO_TEST_SUITE@ test_one test_script
 
-test_one: $(srcdir)/test_one.in Makefile mke2fs.conf
+test_one: $(srcdir)/test_one.in Makefile mke2fs.conf test_data.tmp
        @echo "Creating test_one script..."
        @[ -f test_one ] && chmod u+w test_one || true
        @echo "#!/bin/sh" > test_one
@@ -26,7 +26,7 @@ test_one: $(srcdir)/test_one.in Makefile mke2fs.conf
        @cat $(srcdir)/test_one.in >> test_one
        @chmod +x-w test_one
 
-test_script: test_one test_script.in Makefile mke2fs.conf
+test_script: test_one test_script.in Makefile mke2fs.conf test_data.tmp
        @echo "Creating test_script..."
        @[ -f test_script ] && chmod u+w test_script || true
        @echo "#!/bin/sh" > test_script
@@ -37,6 +37,9 @@ test_script: test_one test_script.in Makefile mke2fs.conf
 mke2fs.conf: $(srcdir)/mke2fs.conf.in
        $(CP) $(srcdir)/mke2fs.conf.in mke2fs.conf
 
+test_data.tmp: $(srcdir)/scripts/gen-test-data
+       $(srcdir)/scripts/gen-test-data > test_data.tmp
+
 .PHONY : test_pre test_post check always_run
 
 always_run:
diff --git a/tests/scripts/gen-test-data b/tests/scripts/gen-test-data
new file mode 100755 (executable)
index 0000000..0cbd928
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+t1="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.  "
+t2="Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.  Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring.  Capitalize on low hanging fruit to identify a ballpark value added activity to beta test. Override the digital divide with additional clickthroughs from DevOps. Nanotechnology immersion along the information highway will close the loop on focusing solely on the bottom line.  "
+t3="Licensed Product under the copyright owner that is not possible to put the Notice in a manner which does not specify a version number of this document is to say, a work based on the Program (including Contributions) may always be distributed subject to the Licensed Product. Intellectual Property Matters. Third Party Claims. If you develop a new version of the Derivative Works, in at least six (6) months after a subsequent version of this section has the right to acquire, license, develop, have others develop for it, market and/or distribute the Program (or a work based on infringement of intellectual property laws of the Package, in its Contribution, if any, specified by the terms of this Agreement more than your cost of all necessary servicing, repair, or correction. In no event and under no obligation to respond to any patent claims licensable by a copyright notice appear in all copies of it that are distributed by the terms applicable to software that is included in any Digital Font Program, which may be used to render or display fonts. Program shall mean a computer system.  "
+
+export LANG=C
+export LC_ALL=C
+
+t="$t1$t2$t3"
+len=${#t}
+
+c=131072
+
+while test $c -gt 0 ; do
+    if test $c -gt $len ; then
+        echo -n "$t"
+       c=$(($c - $len))
+    else
+       echo -n "$t" | cut -c -$(($c - 1))
+       c=0
+    fi
+done
index 1f146ca20cc71f2616e1c5ad9df0304324f4ff53..9dc762ce5a88fc9e38c958763f2556ac2e0f5ac9 100644 (file)
@@ -14,13 +14,6 @@ E2IMAGE_EXE="../misc/e2image"
 DEBUGFS="$USE_VALGRIND ../debugfs/debugfs"
 DEBUGFS_EXE="../debugfs/debugfs"
 TEST_BITS="test_data.tmp"
-if [ ! -s $TEST_BITS ]; then
-       # create a non-sparse test file if possible, since debugfs may be
-       # sparse and cause "debugfs write" (using copy_file()) to skip holes
-       # during testing if SEEK_DATA/SEEK_HOLE or FS_IOC_FIEMAP are available
-       dd if=/dev/urandom of=$TEST_BITS bs=128k count=1 > /dev/null 2>&1 ||
-               TEST_BITS="$DEFBUGFS_EXE"
-fi
 RESIZE2FS_EXE="../resize/resize2fs"
 RESIZE2FS="$USE_VALGRIND $RESIZE2FS_EXE"
 E2UNDO_EXE="../misc/e2undo"