summaryrefslogtreecommitdiff
diff options
authorZygmunt Krynicki <zygmunt.krynicki@canonical.com>2016-06-13 14:44:44 +0200
committerZygmunt Krynicki <zygmunt.krynicki@canonical.com>2016-06-13 15:36:37 +0200
commit4626e5d43a2686f97e1ca068baac5128f6de6cc1 (patch)
treebb2dc390058925d0d5e27ef2e3e87548768348a6
parent506eb060c69d2c03059d0f805acbcf0f2a2a6664 (diff)
Improve distcheck1.0.29
This patch fixes most of 'make distcheck' by unconditionally distributing all tests and by using ${srcdir} rather than $(pwd) to refer to the source directory. The only remaining broken thing is the installation of the udev rules but my reading of the automake documentation doesn't reveal any obviously correct solutions. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
-rw-r--r--src/Makefile.am11
-rw-r--r--tests/Makefile.am10
-rw-r--r--tests/common.sh2
-rwxr-xr-xtests/test_bad_seccomp_filter_length2
-rwxr-xr-xtests/test_bad_seccomp_filter_missing_trailing_newline2
-rwxr-xr-xtests/test_complain2
-rwxr-xr-xtests/test_complain_missed2
-rwxr-xr-xtests/test_noprofile2
-rwxr-xr-xtests/test_restrictions2
-rwxr-xr-xtests/test_restrictions_working2
-rwxr-xr-xtests/test_unrestricted2
-rwxr-xr-xtests/test_unrestricted_missed2
-rwxr-xr-xtests/test_whitelist2
13 files changed, 26 insertions, 17 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 727af29f9d..c8e709d441 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,8 +29,8 @@ endif
check-syntax:
@d=`mktemp -d`; \
trap 'rm -rf $d' EXIT; \
- for f in $(wildcard *.c) $(wildcard *.h); do \
- out="$$d/$$f.out"; \
+ for f in $(wildcard $(srcdir)/*.c) $(wildcard $(srcdir)/*.h); do \
+ out="$$d/`basename $$f.out`"; \
echo "Checking $$f ... "; \
indent -linux "$$f" -o "$$out"; \
diff -Naur "$$f" "$$out" || exit 1; \
@@ -50,15 +50,18 @@ fmt:
EXTRA_DIST = 80-snappy-assign.rules snappy-app-dev
if STRICT_CONFINEMENT
+# NOTE: This makes distcheck fail but it is required for udev, so go figure.
+# http://www.gnu.org/software/automake/manual/automake.html#Hard_002dCoded-Install-Paths
+#
# Install udev rules
install-data-local:
install -d -m 755 $(DESTDIR)$(shell pkg-config udev --variable=udevdir)/rules.d
- install -m 644 80-snappy-assign.rules $(DESTDIR)$(shell pkg-config udev --variable=udevdir)/rules.d
+ install -m 644 $(srcdir)/80-snappy-assign.rules $(DESTDIR)$(shell pkg-config udev --variable=udevdir)/rules.d
# Install support script for udev rules
install-exec-local:
install -d -m 755 $(DESTDIR)$(shell pkg-config udev --variable=udevdir)
- install -m 755 snappy-app-dev $(DESTDIR)$(shell pkg-config udev --variable=udevdir)
+ install -m 755 $(srcdir)/snappy-app-dev $(DESTDIR)$(shell pkg-config udev --variable=udevdir)
endif
# Ensure that snap-confine is +s (setuid)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8c47b88e9f..a0f192c489 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,6 @@
TESTS =
-if STRICT_CONFINEMENT
-TESTS += \
+all_tests = \
test_bad_seccomp_filter_length \
test_bad_seccomp_filter_missing_trailing_newline \
test_complain \
@@ -11,8 +10,15 @@ TESTS += \
test_unrestricted \
test_unrestricted_missed \
test_whitelist
+
+EXTRA_DIST = $(all_tests) common.sh
+
+if STRICT_CONFINEMENT
+TESTS += $(all_tests)
endif
+check: ../src/snap-confine
+
.PHONY: check-syntax
check-syntax:
shellcheck --format=gcc $(wildcard test_*) common.sh
diff --git a/tests/common.sh b/tests/common.sh
index aa9018a0e6..0bca76c54e 100644
--- a/tests/common.sh
+++ b/tests/common.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-
+
L="$(pwd)/../src/snap-confine"
export L
diff --git a/tests/test_bad_seccomp_filter_length b/tests/test_bad_seccomp_filter_length
index 41a9af301a..6752630091 100755
--- a/tests/test_bad_seccomp_filter_length
+++ b/tests/test_bad_seccomp_filter_length
@@ -2,7 +2,7 @@
set -e
-. "$(pwd)/common.sh"
+. "${srcdir:-.}/common.sh"
printf "Test seccomp filter (bad - too long)"
diff --git a/tests/test_bad_seccomp_filter_missing_trailing_newline b/tests/test_bad_seccomp_filter_missing_trailing_newline
index 22c6a11d64..2d5c2230a5 100755
--- a/tests/test_bad_seccomp_filter_missing_trailing_newline
+++ b/tests/test_bad_seccomp_filter_missing_trailing_newline
@@ -2,7 +2,7 @@
set -e
-. "$(pwd)/common.sh"
+. "${srcdir:-.}/common.sh"
printf "Test seccomp filter (bad - no trailing newline)"
diff --git a/tests/test_complain b/tests/test_complain
index 612e874853..ac602d62c1 100755
--- a/tests/test_complain
+++ b/tests/test_complain
@@ -2,7 +2,7 @@
set -e
-. "$(pwd)/common.sh"
+. "${srcdir:-.}/common.sh"
cat >"$TMP/snap.name.app" <<EOF
# some comment
diff --git a/tests/test_complain_missed b/tests/test_complain_missed
index f90a64d1eb..ecd6e0c212 100755
--- a/tests/test_complain_missed
+++ b/tests/test_complain_missed
@@ -2,7 +2,7 @@
set -e
-. "$(pwd)/common.sh"
+. "${srcdir:-.}/common.sh"
cat >"$TMP/snap.name.app" <<EOF
# super strict filter
diff --git a/tests/test_noprofile b/tests/test_noprofile
index 6ae743c4eb..8b2abaabe1 100755
--- a/tests/test_noprofile
+++ b/tests/test_noprofile
@@ -2,7 +2,7 @@
set -e
-. "$(pwd)/common.sh"
+. "${srcdir:-.}/common.sh"
printf "Test that a non-existing profile causes the launcher to not start"
if ! "$L" snap.name.app /bin/ls >"$TMP/testlog" 2>&1 ; then
diff --git a/tests/test_restrictions b/tests/test_restrictions
index 03305c5c4a..feea1c8b22 100755
--- a/tests/test_restrictions
+++ b/tests/test_restrictions
@@ -2,7 +2,7 @@
set -e
-. "$(pwd)/common.sh"
+. "${srcdir:-.}/common.sh"
cat >"$TMP/snap.name.app" <<EOF
# super strict filter
diff --git a/tests/test_restrictions_working b/tests/test_restrictions_working
index e8675bd989..849055a853 100755
--- a/tests/test_restrictions_working
+++ b/tests/test_restrictions_working
@@ -2,7 +2,7 @@
set -e
-. "$(pwd)/common.sh"
+. "${srcdir:-.}/common.sh"
cat >"$TMP/snap.name.app" <<EOF
# filter that works ok for true
diff --git a/tests/test_unrestricted b/tests/test_unrestricted
index 85f4b4b58e..71be1a9025 100755
--- a/tests/test_unrestricted
+++ b/tests/test_unrestricted
@@ -2,7 +2,7 @@
set -e
-. "$(pwd)/common.sh"
+. "${srcdir:-.}/common.sh"
cat >"$TMP/snap.name.app" <<EOF
# some comment
diff --git a/tests/test_unrestricted_missed b/tests/test_unrestricted_missed
index ece1e818d3..2c1e4af378 100755
--- a/tests/test_unrestricted_missed
+++ b/tests/test_unrestricted_missed
@@ -2,7 +2,7 @@
set -e
-. "$(pwd)/common.sh"
+. "${srcdir:-.}/common.sh"
cat >"$TMP/snap.name.app" <<EOF
# super strict filter
diff --git a/tests/test_whitelist b/tests/test_whitelist
index 89d8be35f7..248603ac1c 100755
--- a/tests/test_whitelist
+++ b/tests/test_whitelist
@@ -2,7 +2,7 @@
set -e
-. "$(pwd)/common.sh"
+. "${srcdir:-.}/common.sh"
printf "Test appname whitelist"