Add patches to make sure the tests fail as soon as something goes wrong

This commit is contained in:
Simon McVittie 2016-06-11 19:54:30 +01:00
parent 01fe808189
commit b75cc5f54a
4 changed files with 73 additions and 0 deletions

8
debian/changelog vendored
View File

@ -1,3 +1,11 @@
ostree (2016.5-4) UNRELEASED; urgency=medium
* d/p/test-sysroot.js-set-strict-mode-when-sourcing-libtest.sh.patch,
d/p/tests-Use-strict-mode-by-default-for-C-tests.patch: add patches
to make sure the tests fail as soon as something goes wrong
-- Simon McVittie <smcv@debian.org> Sat, 11 Jun 2016 19:52:40 +0100
ostree (2016.5-3) unstable; urgency=medium
* Remove ostree-grub2 and the boot-related parts of ostree, leaving

View File

@ -1,2 +1,4 @@
libtest-show-files-contents-when-assertions-about-them-fa.patch
test-parent-this-test-requires-user-xattrs.patch
tests-Use-strict-mode-by-default-for-C-tests.patch
test-sysroot.js-set-strict-mode-when-sourcing-libtest.sh.patch

View File

@ -0,0 +1,26 @@
From: Simon McVittie <smcv@debian.org>
Date: Sat, 11 Jun 2016 19:07:40 +0100
Subject: test-sysroot.js: set "strict mode" when sourcing libtest.sh
As with the C tests in commit 08580118, this makes sure the test
fails as soon as something goes wrong.
Signed-off-by: Simon McVittie <smcv@debian.org>
Forwarded: https://github.com/ostreedev/ostree/pull/335
---
tests/test-sysroot.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test-sysroot.js b/tests/test-sysroot.js
index 9468d2f..7c31659 100644
--- a/tests/test-sysroot.js
+++ b/tests/test-sysroot.js
@@ -37,7 +37,7 @@ function libtestExec(shellCode) {
let testdatadir = GLib.getenv("G_TEST_SRCDIR");
let libtestPath = GLib.build_filenamev([testdatadir, 'libtest.sh'])
let proc = GSystem.Subprocess.new_simple_argv(['bash', '-c',
- '. ' + GLib.shell_quote(libtestPath) + '; ' + shellCode],
+ 'set -xeuo pipefail; . ' + GLib.shell_quote(libtestPath) + '; ' + shellCode],
GSystem.SubprocessStreamDisposition.INHERIT,
GSystem.SubprocessStreamDisposition.INHERIT,
null);

View File

@ -0,0 +1,37 @@
From: Colin Walters <walters@verbum.org>
Date: Mon, 6 Jun 2016 15:00:13 -0400
Subject: tests: Use strict mode by default for C tests
I was extending the C-based test suite to cover more, and noticed that
we weren't aborting if a command failed. That made the tests somewhat
less useful, so let's fix it.
Closes: #321
Approved by: jlebon
Origin: upstream, commit:085801185125893a53d7a65732c6832f875ed5d6
---
tests/libostreetest.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/libostreetest.c b/tests/libostreetest.c
index 5828336..a557ee3 100644
--- a/tests/libostreetest.c
+++ b/tests/libostreetest.c
@@ -40,7 +40,7 @@ run_libtest (const char *cmd, GError **error)
g_ptr_array_add (argv, "bash");
g_ptr_array_add (argv, "-c");
- g_string_append (cmdstr, ". ");
+ g_string_append (cmdstr, "set -xeuo pipefail; . ");
g_string_append (cmdstr, builddir);
g_string_append (cmdstr, "/tests/libtest.sh; ");
g_string_append (cmdstr, cmd);
@@ -68,7 +68,7 @@ ot_test_setup_repo (GCancellable *cancellable,
g_autoptr(GFile) repo_path = g_file_new_for_path ("repo");
glnx_unref_object OstreeRepo* ret_repo = NULL;
- if (!run_libtest ("setup_test_repository", error))
+ if (!run_libtest ("setup_test_repository archive-z2", error))
goto out;
ret_repo = ostree_repo_new (repo_path);