# HG changeset patch # User Paul Boddie # Date 1627848626 -7200 # Node ID 32f714dec170f2998d4e578b7c2a6b4d4f801067 # Parent da0fa7c525e01005ef4eabadb024978ee1913bd0 Added test filesystem generation to the build infrastructure. diff -r da0fa7c525e0 -r 32f714dec170 conf/dstest_test.cfg --- a/conf/dstest_test.cfg Sun Aug 01 22:10:19 2021 +0200 +++ b/conf/dstest_test.cfg Sun Aug 01 22:10:26 2021 +0200 @@ -12,12 +12,20 @@ }, log = { "server", "r" }, }, - "rom/dstest_test_server", "20"); + "rom/dstest_test_server", "40"); l:start({ caps = { server = server, }, - log = { "client", "g" }, + log = { "client1", "g" }, }, "rom/dstest_test_client"); + +l:start({ + caps = { + server = server, + }, + log = { "client2", "b" }, + }, + "rom/dstest_test_client"); diff -r da0fa7c525e0 -r 32f714dec170 tests/Makefile --- a/tests/Makefile Sun Aug 01 22:10:19 2021 +0200 +++ b/tests/Makefile Sun Aug 01 22:10:26 2021 +0200 @@ -8,6 +8,7 @@ dstest_host_client \ dstest_pipe_client \ dstest_test_client \ + $(PKGDIR)/../conf/e2test.fs MODE = static @@ -28,3 +29,8 @@ 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 da0fa7c525e0 -r 32f714dec170 tests/mk_e2test.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/mk_e2test.sh Sun Aug 01 22:10:26 2021 +0200 @@ -0,0 +1,72 @@ +#!/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