# HG changeset patch # User Paul Boddie # Date 1627850892 -7200 # Node ID efe24033add9493b66d58c0d6b968d84d5158e8b # Parent 32f714dec170f2998d4e578b7c2a6b4d4f801067 Made a separate package for test file preparation. diff -r 32f714dec170 -r efe24033add9 test_files/Control --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test_files/Control Sun Aug 01 22:48:12 2021 +0200 @@ -0,0 +1,2 @@ +provides: fstest_files +maintainer: paul@boddie.org.uk diff -r 32f714dec170 -r efe24033add9 test_files/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test_files/Makefile Sun Aug 01 22:48:12 2021 +0200 @@ -0,0 +1,13 @@ +PKGDIR ?= . +L4DIR ?= $(PKGDIR)/../../.. + +TARGET = $(PKGDIR)/../conf/e2test.fs + +include $(L4DIR)/mk/Makeconf + +# Special rules to build the test filesystem. + +all:: $(TARGET) + +$(TARGET): + $(PKGDIR)/mk_e2test.sh -q $(PKGDIR) $(L4DIR)/e2access $@ diff -r 32f714dec170 -r efe24033add9 test_files/mk_e2test.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test_files/mk_e2test.sh Sun Aug 01 22:48:12 2021 +0200 @@ -0,0 +1,83 @@ +#!/bin/sh + +THIS_DIR=$(realpath $(dirname "$0")) + +if [ "$1" = '-q' ] ; then + QUIET=$1 + shift 1 +else + QUIET= +fi + +PKGDIR=$1 +E2ACCESS_DIR=$2 +TARGET=$3 + +if [ ! -e "$PKGDIR" ] || [ ! -e "$E2ACCESS_DIR" ] || [ ! "$TARGET" ] ; then + echo "Usage: $0 [ -q ] " 1>&2 + exit 1 +fi + +PKGDIR=`realpath "$PKGDIR"` +E2ACCESS_DIR=`realpath "$E2ACCESS_DIR"` +TARGET=`realpath "$TARGET"` + +# Initialise the program details and environment. + +E2ACCESS="$E2ACCESS_DIR"/e2access +export LD_LIBRARY_PATH="$E2ACCESS_DIR" + +# Make a filesystem for the example. + +mkdir tmp_e2test +cd tmp_e2test +mkdir -p home/paulb/many +cd home/paulb/many + +# Populate the directory with plenty of files. + +for N in `seq 1 400`; do + echo "Contents of #$N." > "file-$N".txt +done + +cd .. + +# Put a file in the directory above. + +cp "$PKGDIR/../docs/LICENCE.txt" . + +# Leave the filesystem root. + +cd ../.. + +# Create a filesystem image. + +EXTRA=2000 +SIZE=$(du -s -k home | cut -f 1) +TOTAL=$(($SIZE + $EXTRA)) + +dd if=/dev/zero of="$TARGET" bs=1024 count=$TOTAL + +if ! $(/sbin/mkfs.ext2 -q "$TARGET") ; then + exit 1 +fi + +# Add the directory and files to the image. + +"$E2ACCESS" "$TARGET" --make-dirs home/paulb/many + +"$E2ACCESS" "$TARGET" --copy-in $(find home/paulb/many -maxdepth 1 -type f | sort) home/paulb/many +"$E2ACCESS" "$TARGET" --copy-in $(find home/paulb -maxdepth 1 -type f | sort) home/paulb + +# Leave the root of the filesystem. + +cd .. + +if [ ! "$QUIET" ] ; then + "$E2ACCESS" "$TARGET" --list-dirs '' + "$E2ACCESS" "$TARGET" --list-dirs 'home' + "$E2ACCESS" "$TARGET" --list-dirs 'home/paulb' + "$E2ACCESS" "$TARGET" --list-dirs 'home/paulb/many' +fi + +rm -r tmp_e2test diff -r 32f714dec170 -r efe24033add9 tests/Control --- a/tests/Control Sun Aug 01 22:10:26 2021 +0200 +++ b/tests/Control Sun Aug 01 22:48:12 2021 +0200 @@ -1,3 +1,3 @@ -requires: libstdc++ libc libipc libfsclient libmem libext2fs libext2fs_blockserver libe2access_blockserver +requires: libstdc++ libc libipc libfsclient libmem libext2fs libext2fs_blockserver libe2access_blockserver fstest_files provides: fstests maintainer: paul@boddie.org.uk diff -r 32f714dec170 -r efe24033add9 tests/Makefile --- a/tests/Makefile Sun Aug 01 22:10:26 2021 +0200 +++ b/tests/Makefile Sun Aug 01 22:48:12 2021 +0200 @@ -7,8 +7,7 @@ dstest_file_client \ dstest_host_client \ dstest_pipe_client \ - dstest_test_client \ - $(PKGDIR)/../conf/e2test.fs + dstest_test_client MODE = static @@ -29,8 +28,3 @@ REQUIRES_LIBS = l4re_c-util libfsclient libmem libipc libstdc++ libsystypes libe2access_blockserver include $(L4DIR)/mk/prog.mk - -# Special rule to build the test filesystem. - -$(PKGDIR)/../conf/e2test.fs: - $(PKGDIR)/mk_e2test.sh $(PKGDIR) $(L4DIR)/e2access $@ diff -r 32f714dec170 -r efe24033add9 tests/mk_e2test.sh --- a/tests/mk_e2test.sh Sun Aug 01 22:10:26 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -#!/bin/sh - -THIS_DIR=$(realpath $(dirname "$0")) - -PKGDIR=$1 -E2ACCESS_DIR=$2 -TARGET=$3 - -if [ ! -e "$PKGDIR" ] || [ ! -e "$E2ACCESS_DIR" ] || [ ! "$TARGET" ] ; then - echo "Usage: $0 " 1>&2 - exit 1 -fi - -TARGET=`realpath "$TARGET"` - -# Initialise the program details and environment. - -E2ACCESS="$E2ACCESS_DIR"/e2access -export LD_LIBRARY_PATH="$E2ACCESS_DIR" - -# Make a filesystem for the example. - -mkdir tmp_e2test -cd tmp_e2test -mkdir -p home/paulb/many -cd home/paulb/many - -# Populate the directory with plenty of files. - -for N in `seq 1 400`; do - echo "Contents of #$N." > "file-$N".txt -done - -cd .. - -# Put a file in the directory above. - -cp "$PKGDIR/../docs/LICENCE.txt" . - -# Leave the filesystem root. - -cd ../.. - -# Create a filesystem image. - -EXTRA=2000 -SIZE=$(du -s -k home | cut -f 1) -TOTAL=$(($SIZE + $EXTRA)) - -dd if=/dev/zero of="$TARGET" bs=1024 count=$TOTAL - -if ! $(/sbin/mkfs.ext2 -q "$TARGET") ; then - exit 1 -fi - -# Add the directory and files to the image. - -"$E2ACCESS" "$TARGET" --make-dirs home/paulb/many - -"$E2ACCESS" "$TARGET" --copy-in $(find home/paulb/many -maxdepth 1 -type f | sort) home/paulb/many -"$E2ACCESS" "$TARGET" --copy-in $(find home/paulb -maxdepth 1 -type f | sort) home/paulb - -# Leave the root of the filesystem. - -cd .. - -"$E2ACCESS" "$TARGET" --list-dirs '' -"$E2ACCESS" "$TARGET" --list-dirs 'home' -"$E2ACCESS" "$TARGET" --list-dirs 'home/paulb' -"$E2ACCESS" "$TARGET" --list-dirs 'home/paulb/many' - -rm -r tmp_e2test