From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

tests: allow building ZFS and ROFS versions of test mps

This patch modifies tests makefile to generate manifest files
for both common and file system (ZFS, ROFS) specific sets of tests.
This allows creating capstan mpm packages intended for use with automated
testing framework.

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>

---
diff --git a/modules/tests/.gitignore b/modules/tests/.gitignore
--- a/modules/tests/.gitignore
+++ b/modules/tests/.gitignore
@@ -1 +1,3 @@
 usr.manifest
+fs.manifest
+common.manifest
diff --git a/modules/tests/Makefile b/modules/tests/Makefile
--- a/modules/tests/Makefile
+++ b/modules/tests/Makefile
@@ -1,4 +1,4 @@
-module: usr.manifest build_all_tests
+module: usr.manifest common.manifest fs.manifest build_all_tests
 
 # Paths set by scripts/build
 src := $(OSV_BASE)
@@ -179,7 +179,7 @@ $(out)/tests/tst-tls-gold.so: \
 
 boost-lib-dir := $(dir $(shell $(CC) --print-file-name libboost_system.so))
 
-boost-tests := tst-vfs.so tst-libc-locking.so misc-fs-stress.so \
+common-boost-tests := tst-vfs.so tst-libc-locking.so misc-fs-stress.so \
        misc-bdev-write.so misc-bdev-wlatency.so misc-bdev-rw.so \
        tst-promise.so tst-dlfcn.so tst-stat.so tst-wait-for.so \
        tst-bsd-tcp1.so tst-bsd-tcp1-zsnd.so tst-bsd-tcp1-zrcv.so \
@@ -188,6 +188,8 @@ boost-tests := tst-vfs.so tst-libc-locking.so 
misc-fs-stress.so \
        tst-rcu-hashtable.so tst-unordered-ring-mpsc.so \
        tst-seek.so
 
+boost-tests := $(common-boost-tests)
+
 rofs-only-boost-tests :=
 
 zfs-only-boost-tests := tst-rename.so
@@ -198,6 +200,7 @@ $(boost-tests:%=$(out)/tests/%): LIBS += \
        -lboost_unit_test_framework \
        -lboost_filesystem
 
+common-tests := $(tests) $(common-boost-tests)
 tests += $(boost-tests)
 
 solaris-tests := tst-solaris-taskq.so
@@ -240,12 +243,24 @@ usr.manifest: build_all_tests $(lastword 
$(MAKEFILE_LIST)) usr.manifest.skel FOR
        @ldd $(addprefix $(out)/tests/,$(boost-tests)) | grep libboost | sed 
's/ *[^ ] *\(.*\) => \(.*\) .*/\/usr\/lib\/\1: \2/' | sort | uniq >> $@
        @echo $(all_tests) | tr ' ' '\n' | grep -v "tests/rofs/tst-.*.so" | awk 
'{print "/" $$0 ": ./" $$0}' >> $@
        @echo $(all_tests) | tr ' ' '\n' | grep "tests/rofs/tst-.*.so" | sed 
's/\.so//' | awk 'BEGIN { FS = "/" } ; { print "/tests/" $$3 "-rofs.so: 
./tests/" $$2 "/" $$3 ".so"}' >> $@
-       ./create_static.sh $(out) $(fs_type)
+       ./create_static.sh $(out) usr.manifest $(fs_type)
 .PHONY: FORCE
 FORCE:
 
+common.manifest: build_all_tests $(lastword $(MAKEFILE_LIST)) 
usr.manifest.skel FORCE
+       @echo "  generating modules/tests/common.manifest"
+       @cat usr.manifest.skel > $@
+       @ldd $(addprefix $(out)/tests/,$(boost-tests)) | grep libboost | sed 
's/ *[^ ] *\(.*\) => \(.*\) .*/\/usr\/lib\/\1: \2/' | sort | uniq >> $@
+       @echo $(common-tests) $(solaris-tests) | tr ' ' '\n' | awk '{print 
"/tests/" $$0 ": ./tests/" $$0}' >> $@
+
+fs.manifest: build_all_tests $(lastword $(MAKEFILE_LIST)) FORCE
+       @echo "  generating modules/tests/fs.manifest"
+       @echo $(specific-fs-tests) $($(fs_type)-only-boost-tests) | tr ' ' '\n' 
| grep -v "rofs/tst-.*.so" | awk '{print "/tests/" $$0 ": ./tests/" $$0}' > $@
+       @echo $(specific-fs-tests) $($(fs_type)-only-boost-tests) | tr ' ' '\n' 
| grep "rofs/tst-.*.so" | sed 's/\.so//' | awk 'BEGIN { FS = "/" } ; { print 
"/tests/" $$2 "-rofs.so: ./tests/" $$1 "/" $$2 ".so"}' >> $@
+       ./create_static.sh $(out) fs.manifest $(fs_type)
+
 clean:
-       -rm -f usr.manifest
+       -rm -f usr.manifest common.manifest fs.manifest
 
 ifneq ($(MAKECMDGOALS),clean)
 include $(shell test -d $(out)/tests && find $(out)/tests -name '*.d')
diff --git a/modules/tests/create_static.sh b/modules/tests/create_static.sh
--- a/modules/tests/create_static.sh
+++ b/modules/tests/create_static.sh
@@ -3,7 +3,8 @@
 THIS_PATH=$(readlink -f $0)
 THIS_DIRECTORY=$(dirname ${THIS_PATH})
 OUT=$1
-FS=${2-zfs}
+MANIFEST=$2
+FS=${3-zfs}
 
 #Clean the directory
 rm -rf ${OUT}/tests/static
@@ -12,25 +13,25 @@ if [ ${FS} = "rofs" ]
 then
        mkdir -p ${OUT}/tests/static/rofs/tst-readdir-empty
        mkdir -p ${OUT}/tests/static/rofs/tst-readdir
-       touch ${OUT}/tests/static/rofs/tst-readdir/aaa
+       echo "Content" > ${OUT}/tests/static/rofs/tst-readdir/aaa
 
        mkdir -p ${OUT}/tests/static/rofs/tst-chdir
-       touch ${OUT}/tests/static/rofs/tst-chdir/f
+       echo "Content" > ${OUT}/tests/static/rofs/tst-chdir/f
 
        mkdir -p ${OUT}/tests/static/rofs/tst-symlink
-       touch ${OUT}/tests/static/rofs/tst-symlink/f1
+       echo "Content" > ${OUT}/tests/static/rofs/tst-symlink/f1
        cd ${OUT}/tests/static/rofs/tst-symlink && ln -s f1 f2_AAA
 
-       echo '/rofs/tst-readdir-empty: ./tests/static/rofs/tst-readdir-empty' 
>> ${THIS_DIRECTORY}/usr.manifest
-       echo '/rofs/tst-chdir/f: ./tests/static/rofs/tst-chdir/f' >> 
${THIS_DIRECTORY}/usr.manifest
-       echo '/rofs/tst-readdir/aaa: ./tests/static/rofs/tst-readdir/aaa' >> 
${THIS_DIRECTORY}/usr.manifest
-       echo '/rofs/tst-symlink/f1: ./tests/static/rofs/tst-symlink/f1' >> 
${THIS_DIRECTORY}/usr.manifest
-       echo '/rofs/tst-symlink/f2_AAA: ->/rofs/tst-symlink/f1' >> 
${THIS_DIRECTORY}/usr.manifest
+       echo '/rofs/tst-readdir-empty: ./tests/static/rofs/tst-readdir-empty' 
>> ${THIS_DIRECTORY}/${MANIFEST}
+       echo '/rofs/tst-chdir/f: ./tests/static/rofs/tst-chdir/f' >> 
${THIS_DIRECTORY}/${MANIFEST}
+       echo '/rofs/tst-readdir/aaa: ./tests/static/rofs/tst-readdir/aaa' >> 
${THIS_DIRECTORY}/${MANIFEST}
+       echo '/rofs/tst-symlink/f1: ./tests/static/rofs/tst-symlink/f1' >> 
${THIS_DIRECTORY}/${MANIFEST}
+       echo '/rofs/tst-symlink/f2_AAA: ->/rofs/tst-symlink/f1' >> 
${THIS_DIRECTORY}/${MANIFEST}
 
        #This file is around 700K so it is a good test sample for the 
concurrent test
-       echo '/rofs/mmap-file-test1: ./core/spinlock.o' >> 
${THIS_DIRECTORY}/usr.manifest
-       echo '/rofs/mmap-file-test2: ./core/spinlock.o' >> 
${THIS_DIRECTORY}/usr.manifest
+       echo '/rofs/mmap-file-test1: ./core/spinlock.o' >> 
${THIS_DIRECTORY}/${MANIFEST}
+       echo '/rofs/mmap-file-test2: ./core/spinlock.o' >> 
${THIS_DIRECTORY}/${MANIFEST}
 else
-       echo '/tmp/mmap-file-test1: ./core/spinlock.o' >> 
${THIS_DIRECTORY}/usr.manifest
-       echo '/tmp/mmap-file-test2: ./core/spinlock.o' >> 
${THIS_DIRECTORY}/usr.manifest
+       echo '/tmp/mmap-file-test1: ./core/spinlock.o' >> 
${THIS_DIRECTORY}/${MANIFEST}
+       echo '/tmp/mmap-file-test2: ./core/spinlock.o' >> 
${THIS_DIRECTORY}/${MANIFEST}
 fi
diff --git a/modules/tests/mpm/package.yaml b/modules/tests/mpm/package.yaml
--- a/modules/tests/mpm/package.yaml
+++ b/modules/tests/mpm/package.yaml
@@ -2,3 +2,4 @@ name: osv.unit-tests
 title: OSv Unit Tests
 require:
 - osv.openjdk8-from-host
+- osv.common-tests
diff --git a/modules/tests/test.sh b/modules/tests/test.sh
--- a/modules/tests/test.sh
+++ b/modules/tests/test.sh
@@ -1,4 +1,15 @@
 #!/bin/bash
 
 THIS_DIR=$(readlink -f $(dirname $0))
-$THIS_DIR/../../scripts/test.py -p $OSV_HYPERVISOR
+
+if [ "$OSV_KERNEL" != "" ]; then
+  echo "Running with kernel $OSV_KERNEL"
+  if [ "$OSV_HYPERVISOR" == "firecracker" ]; then
+     RUN_OPTIONS="--kernel $OSV_KERNEL"
+  else
+     RUN_OPTIONS="-k --kernel-path $OSV_KERNEL"
+  fi
+  $THIS_DIR/../../scripts/test.py -p $OSV_HYPERVISOR --blacklist 
tracing_smoke_test --run_options "$RUN_OPTIONS"
+else
+  $THIS_DIR/../../scripts/test.py -p $OSV_HYPERVISOR --blacklist 
tracing_smoke_test
+fi

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/000000000000e9d7b305a3c3b66e%40google.com.

Reply via email to