Commit c6ebe63c authored by nextime's avatar nextime

As old tests fix for qemu wasn't working as expected, re-do it in

another way
parent a8aaa975
udisks2 (2.1.3-5+devuan3) unstable; urgency=medium
* As the previous fix for tests in qemu doesn't work well, re-do it in
another way
-- Franco (nextime) Lanza <nextime@nexlab.it> Wed, 15 Apr 2015 23:11:48 +0200
udisks2 (2.1.3-5+devuan2) unstable; urgency=medium
* Fix tests to make it build on qemu-arch-static.
......
diff --git a/src/tests/helper.c b/src/tests/helper.c
index 388494d..3b6445d 100644
--- a/src/tests/helper.c
+++ b/src/tests/helper.c
@@ -36,7 +36,7 @@ main (int argc, char *argv[])
ret = 1;
- g_assert_cmpint (argc, ==, 2);
+ g_assert_cmpint (argc, >=, 2);
switch (strtol (argv[1], NULL, 10))
{
case 0:
diff --git a/src/tests/test.c b/src/tests/test.c
index f828ffa..d502b0b 100644
--- a/src/tests/test.c
+++ b/src/tests/test.c
@@ -299,18 +299,18 @@ test_spawned_job_abnormal_termination (void)
UDisksSpawnedJob *job;
gchar *s;
- s = g_strdup_printf (UDISKS_TEST_DIR "/udisks-test-helper 4");
+ s = g_strdup_printf (UDISKS_TEST_DIR "/udisks-test-helper 4 2> /dev/null");
job = udisks_spawned_job_new (s, NULL, getuid (), geteuid (), NULL, NULL);
_g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_failure),
- (gpointer) "Command-line `./udisks-test-helper 4' was signaled with signal SIGSEGV (11): "
+ (gpointer) "Command-line `./udisks-test-helper 4 2> /dev/null' was signaled with signal SIGSEGV (11): "
"OK, deliberately causing a segfault\n");
g_object_unref (job);
g_free (s);
- s = g_strdup_printf (UDISKS_TEST_DIR "/udisks-test-helper 5");
+ s = g_strdup_printf (UDISKS_TEST_DIR "/udisks-test-helper 5 2> /dev/null");
job = udisks_spawned_job_new (s, NULL, getuid (), geteuid (), NULL, NULL);
_g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_failure),
- (gpointer) "Command-line `./udisks-test-helper 5' was signaled with signal SIGABRT (6): "
+ (gpointer) "Command-line `./udisks-test-helper 5 2> /dev/null' was signaled with signal SIGABRT (6): "
"OK, deliberately abort()'ing\n");
g_object_unref (job);
g_free (s);
diff --git a/src/tests/test.c b/src/tests/test.c
index f828ffa..d022474 100644
--- a/src/tests/test.c
+++ b/src/tests/test.c
@@ -24,6 +24,7 @@
#include <sys/types.h>
#include <sys/wait.h>
+#include <stdio.h>
#include <string.h>
#include <udisksdaemontypes.h>
@@ -296,6 +297,7 @@ test_spawned_job_exit_status (void)
static void
test_spawned_job_abnormal_termination (void)
{
+
UDisksSpawnedJob *job;
gchar *s;
@@ -534,6 +536,8 @@ main (int argc,
{
int ret;
+ char cmdline[14];
+
g_type_init ();
g_test_init (&argc, &argv, NULL);
@@ -550,7 +554,18 @@ main (int argc,
g_test_add_func ("/udisks/daemon/spawned_job/read_stdout", test_spawned_job_read_stdout);
g_test_add_func ("/udisks/daemon/spawned_job/read_stderr", test_spawned_job_read_stderr);
g_test_add_func ("/udisks/daemon/spawned_job/exit_status", test_spawned_job_exit_status);
- g_test_add_func ("/udisks/daemon/spawned_job/abnormal_termination", test_spawned_job_abnormal_termination);
+ // test if we are running inside a qemu chroot: it will make this test fail!
+ FILE *fp = fopen("/proc/self/cmdline", "r");
+ // if file doesn't exists, we can bet we are in a chroot without /proc mounted
+ if(fp) {
+ fgets(cmdline, 14, fp);
+ if (strncmp(cmdline, "/usr/bin/qemu-", 14)) {
+ g_test_add_func ("/udisks/daemon/spawned_job/abnormal_termination", test_spawned_job_abnormal_termination);
+ }
+ fclose(fp);
+ } else {
+ g_test_add_func ("/udisks/daemon/spawned_job/abnormal_termination", test_spawned_job_abnormal_termination);
+ }
g_test_add_func ("/udisks/daemon/spawned_job/binary_output", test_spawned_job_binary_output);
g_test_add_func ("/udisks/daemon/spawned_job/input_string", test_spawned_job_input_string);
g_test_add_func ("/udisks/daemon/threaded_job/successful", test_threaded_job_successful);
......@@ -3,4 +3,4 @@
mount_in_media.patch
unsupported_acls.patch
#libsystemd.patch
qemu-fixtests.patch
qemu-testfix.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment