diff -ruN schroot-1.2.1-old/test/Makefile.am schroot-1.2.1/test/Makefile.am --- schroot-1.2.1-old/test/Makefile.am +++ schroot-1.2.1/test/Makefile.am @@ -59,6 +59,22 @@ sbuild-util \ schroot-base-option-action \ cleanup-test-data + +ROOT_TESTS = $(TESTS) +NONROOT_TESTS = setup-test-data \ + sbuild-chroot \ + sbuild-dirstream \ + sbuild-environment \ + sbuild-keyfile \ + sbuild-log \ + sbuild-nostream \ + sbuild-parse-value \ + sbuild-personality \ + sbuild-run-parts \ + sbuild-regex \ + sbuild-util \ + schroot-base-option-action \ + cleanup-test-data endif libtest_la_SOURCES = \ @@ -132,5 +148,82 @@ setup-test-data \ cleanup-test-data +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ + srcdir=$(srcdir); export srcdir; \ + if [[ $EUID -ne 0 ]]; then \ + list=' $(NONROOT_TESTS) '; \ + else \ + list=' $(ROOT_TESTS) '; \ + fi; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + clean-local: $(srcdir)/cleanup-test-data diff -ruN schroot-1.2.1-old/test/setup-test-data schroot-1.2.1/test/setup-test-data --- schroot-1.2.1-old/test/setup-test-data +++ schroot-1.2.1/test/setup-test-data @@ -4,4 +4,9 @@ rm -rf testdata mkdir testdata cp -r ${srcdir}/*.ex* testdata -chown -R root:root testdata +if [[ $EUID -ne 0 ]]; then + echo "You are not root, only performing partial setup" +else + chown -R root:root testdata +fi +