From b0d89755826d4e643c5aec8d1e8df1cbe2a587bc Mon Sep 17 00:00:00 2001 From: Tsutomu Itoh Date: Mon, 21 Nov 2016 14:10:41 +0900 Subject: btrfs-progs: test: fix how to make test files in fsck-tests 013 In my test environment, following error was occurred because the size of /lib/modules/`uname -r`/* is larger than 1GB. # make test-fsck [TEST] fsck-tests.sh [TEST/fsck] 013-extent-tree-rebuild failed: cp -aR /lib/modules/4.9.0-rc5/ /test/btrfs-progs/tests/mnt test failed for case 013-extent-tree-rebuild Makefile:272: recipe for target 'test-fsck' failed make: *** [test-fsck] Error 1 # In this test case, 'generate_dataset small' is enough for making the test files, so I will use 'generate_dataset' instead of 'cp'. For this, move 'generate_dataset()' from 'common.convert' to 'common'. Signed-off-by: Tsutomu Itoh Signed-off-by: David Sterba --- tests/common | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) (limited to 'tests/common') diff --git a/tests/common b/tests/common index 5430f822..71806c24 100644 --- a/tests/common +++ b/tests/common @@ -313,6 +313,95 @@ check_kernel_support() return 0 } +# how many files to create. +DATASET_SIZE=50 + +generate_dataset() { + + dataset_type="$1" + dirpath=$TEST_MNT/$dataset_type + run_check $SUDO_HELPER mkdir -p "$dirpath" + + case $dataset_type in + small) + for num in $(seq 1 "$DATASET_SIZE"); do + run_check $SUDO_HELPER dd if=/dev/urandom of="$dirpath/$dataset_type.$num" bs=10K \ + count=1 >/dev/null 2>&1 + done + ;; + + hardlink) + for num in $(seq 1 "$DATASET_SIZE"); do + run_check $SUDO_HELPER touch $dirpath/$dataset_type.$num + run_check $SUDO_HELPER ln "$dirpath/$dataset_type.$num" "$dirpath/hlink.$num" + done + ;; + + fast_symlink) + for num in $(seq 1 "$DATASET_SIZE"); do + run_check $SUDO_HELPER touch $dirpath/$dataset_type.$num + run_check cd "$dirpath" && \ + $SUDO_HELPER ln -s "$dataset_type.$num" "$dirpath/slink.$num" && \ + cd / + done + ;; + + brokenlink) + for num in $(seq 1 "$DATASET_SIZE"); do + run_check $SUDO_HELPER ln -s "$dirpath/$dataset_type.$num" "$dirpath/blink.$num" + done + ;; + + perm) + for modes in 777 775 755 750 700 666 664 644 640 600 444 440 400 000 \ + 1777 1775 1755 1750 1700 1666 1664 1644 1640 1600 1444 1440 1400 1000 \ + 2777 2775 2755 2750 2700 2666 2664 2644 2640 2600 2444 2440 2400 2000 \ + 4777 4775 4755 4750 4700 4666 4664 4644 4640 4600 4444 4440 4400 4000; do + if [[ "$modes" == *9* ]] || [[ "$modes" == *8* ]] + then + continue; + else + run_check $SUDO_HELPER touch "$dirpath/$dataset_type.$modes" + run_check $SUDO_HELPER chmod "$modes" "$dirpath/$dataset_type.$modes" + fi + done + ;; + + sparse) + for num in $(seq 1 "$DATASET_SIZE"); do + run_check $SUDO_HELPER dd if=/dev/urandom of="$dirpath/$dataset_type.$num" bs=10K \ + count=1 >/dev/null 2>&1 + run_check $SUDO_HELPER truncate -s 500K "$dirpath/$dataset_type.$num" + run_check $SUDO_HELPER dd if=/dev/urandom of="$dirpath/$dataset_type.$num" bs=10K \ + oflag=append conv=notrunc count=1 >/dev/null 2>&1 + run_check $SUDO_HELPER truncate -s 800K "$dirpath/$dataset_type.$num" + done + ;; + + acls) + for num in $(seq 1 "$DATASET_SIZE"); do + run_check $SUDO_HELPER touch "$dirpath/$dataset_type.$num" + run_check $SUDO_HELPER setfacl -m "u:root:x" "$dirpath/$dataset_type.$num" + run_check $SUDO_HELPER setfattr -n user.foo -v "bar$num" "$dirpath/$dataset_type.$num" + done + ;; + + fifo) + for num in $(seq 1 "$DATASET_SIZE"); do + run_check $SUDO_HELPER mkfifo "$dirpath/$dataset_type.$num" + done + ;; + + slow_symlink) + long_filename=`date +%s | sha256sum | cut -f1 -d'-'` + run_check $SUDO_HELPER touch "$dirpath/$long_filename" + for num in $(seq 1 "$DATASET_SIZE"); do + run_check $SUDO_HELPER ln -s "$dirpath/$long_filename" "$dirpath/slow_slink.$num" + done + ;; + esac +} + init_env() { TEST_MNT="${TEST_MNT:-$TOP/tests/mnt}" -- cgit v1.2.3