1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
--- schroot-1.4.7.orig/configure.ac
+++ schroot-1.4.7/configure.ac
@@ -265,6 +265,19 @@ AC_ARG_WITH([bash-completion-dir], [AS_H
AC_MSG_RESULT([$bashcompletiondir])
AC_SUBST([bashcompletiondir])
+AC_MSG_CHECKING([whether to enable root-only unit tests])
+AC_ARG_ENABLE([root-tests], [AS_HELP_STRING([--with-root-tests], [Enable root-only tests])],
+ [ case "${enableval}" in
+ yes) enable_root_tests="yes" ;;
+ no) enable_root_tests="no" ;;
+ *) AC_MSG_RESULT([unknown])
+ AC_MSG_ERROR([bad value ${enableval} for --enable-root-tests]) ;;
+ esac],
+ [ enable_root_tests="yes" ])
+AC_MSG_RESULT([$enable_root_tests])
+AM_CONDITIONAL([USE_ROOT_TESTS], [test "$enable_root_tests" = "yes"])
+AC_SUBST([enable_root_tests])
+
# Checks for programs.
AC_PROG_CXX
AC_LANG([C++])
--- schroot-1.4.7.orig/test/Makefile.am
+++ schroot-1.4.7/test/Makefile.am
@@ -24,10 +24,12 @@ include $(top_srcdir)/scripts/global.mk
LOCAL_CXXFLAGS = $(SCHROOT_CFLAGS) $(CPPUNIT_CFLAGS) -DTESTDATADIR='"./testdata"' -I$(top_srcdir)/bin
if USE_UNIT_TESTS
-noinst_LTLIBRARIES = libtest.la
+check_LTLIBRARIES = libtest.la
-noinst_PROGRAMS = \
- sbuild-chroot \
+ROOT_TESTS =
+
+if USE_ROOT_TESTS
+ROOT_TESTS += \
sbuild-chroot-plain \
sbuild-chroot-file \
sbuild-chroot-directory \
@@ -35,7 +37,12 @@ noinst_PROGRAMS = \
sbuild-chroot-loopback \
sbuild-chroot-lvm-snapshot \
sbuild-chroot-btrfs-snapshot \
- sbuild-chroot-config \
+ sbuild-chroot-config
+endif
+
+check_PROGRAMS = \
+ sbuild-chroot \
+ $(ROOT_TESTS) \
sbuild-environment \
sbuild-keyfile \
sbuild-lock \
@@ -52,14 +59,7 @@ noinst_PROGRAMS = \
# randomly on slow or heavily-loaded systems.
TESTS = setup-test-data \
sbuild-chroot \
- sbuild-chroot-plain \
- sbuild-chroot-file \
- sbuild-chroot-directory \
- sbuild-chroot-block-device \
- sbuild-chroot-loopback \
- sbuild-chroot-lvm-snapshot \
- sbuild-chroot-btrfs-snapshot \
- sbuild-chroot-config \
+ $(ROOT_TESTS) \
sbuild-environment \
sbuild-keyfile \
sbuild-log \
--- schroot-1.4.7.orig/test/setup-test-data
+++ schroot-1.4.7/test/setup-test-data
@@ -4,4 +4,8 @@
rm -rf testdata
mkdir testdata
cp -r ${srcdir}/*.ex* testdata
+if test `id -u` -ne 0; then
+echo "You are not root, only doing partial setup"
+else
chown -R root:root testdata
+fi
|