summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2019-01-03 14:10:32 -0500
committerTheodore Ts'o <tytso@mit.edu>2019-01-03 14:10:32 -0500
commit877580939902798c959df0042a1843a3970a49c2 (patch)
treeada0c9c436026abe3020d4880618e73e7959306e /tests
parent112b38676bb47c1a6723eb01be7794ed564432a4 (diff)
downloade2fsprogs-877580939902798c959df0042a1843a3970a49c2.tar.gz
tests: generate test_data.tmp file from a script
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.in7
-rwxr-xr-xtests/scripts/gen-test-data23
-rw-r--r--tests/test_config7
3 files changed, 28 insertions, 9 deletions
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 8c4d2048..d9f8c731 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -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
index 00000000..0cbd9289
--- /dev/null
+++ b/tests/scripts/gen-test-data
@@ -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
diff --git a/tests/test_config b/tests/test_config
index 1f146ca2..9dc762ce 100644
--- a/tests/test_config
+++ b/tests/test_config
@@ -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"