Skip to content

Commit

Permalink
refactor test targets and let build fail on test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
reinerh committed Oct 24, 2020
1 parent e71289d commit cd75258
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 47 deletions.
57 changes: 12 additions & 45 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ clean:
for dir in $$(dirname $(ALL_ITEMS)) $(MYDIRS); do \
$(MAKE) -C $$dir clean; \
done
$(MAKE) -C test clean
rm -f $(MANPAGES) $(MANPAGES:%=%.gz) firejail*.rpm
rm -f $(SECCOMP_FILTERS)
rm -f test/utils/index.html*
Expand Down Expand Up @@ -227,45 +228,11 @@ scan-build: clean
# make test
#

TESTS=profiles private-lib apps apps-x11 apps-x11-xorg sysutils utils environment filters arguments fs fcopy fnetfilter
TEST_TARGETS=$(patsubst %,test-%,$(TESTS))

test-profiles:
cd test/profiles; ./profiles.sh | grep TESTING

test-private-lib:
cd test/private-lib; ./private-lib.sh | grep TESTING

test-apps:
cd test/apps; ./apps.sh | grep TESTING

test-apps-x11:
cd test/apps-x11; ./apps-x11.sh | grep TESTING

test-apps-x11-xorg:
cd test/apps-x11-xorg; ./apps-x11-xorg.sh | grep TESTING

test-sysutils:
cd test/sysutils; ./sysutils.sh | grep TESTING

test-utils:
cd test/utils; ./utils.sh | grep TESTING

test-environment:
cd test/environment; ./environment.sh | grep TESTING

test-filters:
cd test/filters; ./filters.sh | grep TESTING

test-arguments:
cd test/arguments; ./arguments.sh | grep TESTING

test-fs:
cd test/fs; ./fs.sh | grep TESTING

test-fcopy:
cd test/fcopy; ./fcopy.sh | grep TESTING

test-fnetfilter:
cd test/fnetfilter; ./fnetfilter.sh | grep TESTING
$(TEST_TARGETS):
$(MAKE) -C test $(subst test-,,$@)

test: test-profiles test-private-lib test-fcopy test-fnetfilter test-fs test-utils test-sysutils test-environment test-apps test-apps-x11 test-apps-x11-xorg test-filters test-arguments
echo "TEST COMPLETE"
Expand All @@ -284,32 +251,32 @@ test-travis: test-profiles test-fcopy test-fnetfilter test-fs test-utils test-sy

# a firejail-test account is required, public/private key setup
test-ssh:
cd test/ssh; ./ssh.sh | grep TESTING
$(MAKE) -C test $(subst test-,,$@)

# requires root access
test-chroot:
cd test/chroot; ./chroot.sh | grep testing
$(MAKE) -C test $(subst test-,,$@)

# Huge appimage files, not included in "make dist" archive
test-appimage:
cd test/appimage; ./appimage.sh | grep TESTING
$(MAKE) -C test $(subst test-,,$@)

# Root access, network devices are created before the test
# restart your computer to get rid of these devices
test-network:
cd test/network; ./network.sh | grep TESTING
$(MAKE) -C test $(subst test-,,$@)

# requires the same setup as test-network
test-stress:
cd test/stress; ./stress.sh | grep TESTING
$(MAKE) -C test $(subst test-,,$@)

# Tests running a root user
test-root:
cd test/root; su -c ./root.sh | grep TESTING
$(MAKE) -C test $(subst test-,,$@)

# OverlayFS is not available on all platforms
test-overlay:
cd test/overlay; ./overlay.sh | grep TESTING
$(MAKE) -C test $(subst test-,,$@)

# For testing hidepid system, the command to set it up is "mount -o remount,rw,hidepid=2 /proc"

Expand Down
3 changes: 2 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -4257,7 +4257,7 @@ fi

ac_config_files="$ac_config_files mkdeb.sh"

ac_config_files="$ac_config_files Makefile src/common.mk src/lib/Makefile src/fcopy/Makefile src/fnet/Makefile src/firejail/Makefile src/fnetfilter/Makefile src/firemon/Makefile src/libtrace/Makefile src/libtracelog/Makefile src/firecfg/Makefile src/fbuilder/Makefile src/fsec-print/Makefile src/ftee/Makefile src/faudit/Makefile src/fseccomp/Makefile src/fldd/Makefile src/libpostexecseccomp/Makefile src/fsec-optimize/Makefile src/profstats/Makefile src/man/Makefile"
ac_config_files="$ac_config_files Makefile src/common.mk src/lib/Makefile src/fcopy/Makefile src/fnet/Makefile src/firejail/Makefile src/fnetfilter/Makefile src/firemon/Makefile src/libtrace/Makefile src/libtracelog/Makefile src/firecfg/Makefile src/fbuilder/Makefile src/fsec-print/Makefile src/ftee/Makefile src/faudit/Makefile src/fseccomp/Makefile src/fldd/Makefile src/libpostexecseccomp/Makefile src/fsec-optimize/Makefile src/profstats/Makefile src/man/Makefile test/Makefile"

cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
Expand Down Expand Up @@ -4988,6 +4988,7 @@ do
"src/fsec-optimize/Makefile") CONFIG_FILES="$CONFIG_FILES src/fsec-optimize/Makefile" ;;
"src/profstats/Makefile") CONFIG_FILES="$CONFIG_FILES src/profstats/Makefile" ;;
"src/man/Makefile") CONFIG_FILES="$CONFIG_FILES src/man/Makefile" ;;
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ AC_CONFIG_FILES([mkdeb.sh], [chmod +x mkdeb.sh])
AC_OUTPUT(Makefile src/common.mk src/lib/Makefile src/fcopy/Makefile src/fnet/Makefile src/firejail/Makefile src/fnetfilter/Makefile \
src/firemon/Makefile src/libtrace/Makefile src/libtracelog/Makefile src/firecfg/Makefile src/fbuilder/Makefile src/fsec-print/Makefile \
src/ftee/Makefile src/faudit/Makefile src/fseccomp/Makefile src/fldd/Makefile src/libpostexecseccomp/Makefile src/fsec-optimize/Makefile \
src/profstats/Makefile src/man/Makefile)
src/profstats/Makefile src/man/Makefile test/Makefile)

echo
echo "Configuration options:"
Expand Down
11 changes: 11 additions & 0 deletions test/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
TESTS=$(patsubst %/,%,$(wildcard */))

.PHONY: $(TESTS)

$(TESTS):
echo $(TESTS)
cd $@ && ./$@.sh 2>&1 | tee $@.log
cd $@ && grep -a TESTING $@.log && grep -a -L "TESTING ERROR" $@.log

clean:
for test in $(TESTS); do rm -f "$$test/$$test.log"; done

0 comments on commit cd75258

Please sign in to comment.