Skip to content

Commit

Permalink
thunderbolt: move test for mock environment (Closes #280)
Browse files Browse the repository at this point in the history
umockdev 0.9.4 changed how to test for running in mock and this
causes the assumptions on mock testing at init to fail.

Move the test for this to after the environment has been set up.
  • Loading branch information
Mario Limonciello committed Oct 19, 2017
1 parent 69b2133 commit e1ebc57
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions plugins/thunderbolt/fu-self-test.c
Expand Up @@ -902,6 +902,12 @@ test_set_up (ThunderboltTest *tt, gconstpointer params)
g_assert_nonnull (tt->tree);
}

if (!umockdev_in_mock_environment ()) {
g_warning ("Need to run within umockdev wrapper (umockdev-wrapper %s)!",
program_invocation_short_name);
return;
}

if (flags & TEST_ATTACH_AND_COLDPLUG) {
g_assert_true (flags & TEST_INITIALIZE_TREE);

Expand Down Expand Up @@ -1263,11 +1269,6 @@ main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
g_log_set_fatal_mask (NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);

if (!umockdev_in_mock_environment ()) {
g_warning ("Need to run within umockdev wrapper (umockdev-wrapper %s)!",
program_invocation_short_name);
return EXIT_FAILURE;
}

g_test_add ("/thunderbolt/basic",
ThunderboltTest,
Expand Down

0 comments on commit e1ebc57

Please sign in to comment.