From 59bffbce853534e39bebe3cf2c23f70a61f3fdc5 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 17 Jul 2012 08:08:04 +0200 Subject: [PATCH] Don't rely on loading order for duplicate modules * We had relied on module 'two' loading before 'two-duplicate' in the conf tests. However this isn't always the case, and the name of the module can end up as 'two-duplicate' https://bugzilla.gnome.org/show_bug.cgi?id=44740 --- tests/Makefile.am | 7 ++++++- tests/files/system-modules/four.module | 3 +++ tests/files/system-modules/two.badname | 2 -- tests/files/system-modules/win32/four.module | 3 +++ tests/test-modules.c | 6 +++--- 5 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 tests/files/system-modules/four.module create mode 100644 tests/files/system-modules/win32/four.module diff --git a/tests/Makefile.am b/tests/Makefile.am index 1f6083f..c25ed57 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -45,7 +45,8 @@ TESTS = $(CHECK_PROGS:=$(EXEEXT)) noinst_LTLIBRARIES = \ mock-one.la \ mock-two.la \ - mock-three.la + mock-three.la \ + mock-four.la mock_one_la_SOURCES = \ mock-module.c mock-module.h \ @@ -66,6 +67,10 @@ mock_three_la_SOURCES = $(mock_one_la_SOURCES) mock_three_la_LDFLAGS = $(mock_one_la_LDFLAGS) mock_three_la_LIBADD = $(mock_one_la_LIBADD) +mock_four_la_SOURCES = $(mock_one_la_SOURCES) +mock_four_la_LDFLAGS = $(mock_one_la_LDFLAGS) +mock_four_la_LIBADD = $(mock_one_la_LIBADD) + EXTRA_DIST = \ cutest \ files diff --git a/tests/files/system-modules/four.module b/tests/files/system-modules/four.module new file mode 100644 index 0000000..6eace3c --- /dev/null +++ b/tests/files/system-modules/four.module @@ -0,0 +1,3 @@ + +module: mock-four.so +disable-in: test-disable, test-other diff --git a/tests/files/system-modules/two.badname b/tests/files/system-modules/two.badname index b6d0f7f..0d41cac 100644 --- a/tests/files/system-modules/two.badname +++ b/tests/files/system-modules/two.badname @@ -3,5 +3,3 @@ module: mock-two.so setting: system2 - -disable-in: test-disable, test-other \ No newline at end of file diff --git a/tests/files/system-modules/win32/four.module b/tests/files/system-modules/win32/four.module new file mode 100644 index 0000000..7fd1540 --- /dev/null +++ b/tests/files/system-modules/win32/four.module @@ -0,0 +1,3 @@ + +module: mock-four.dll +disable-in: test-disable, test-other diff --git a/tests/test-modules.c b/tests/test-modules.c index f755298..74560d9 100644 --- a/tests/test-modules.c +++ b/tests/test-modules.c @@ -137,12 +137,12 @@ test_disable (CuTest *tc) CK_FUNCTION_LIST_PTR_PTR modules; /* - * The module two should be present, as we don't match any prognames + * The module four should be present, as we don't match any prognames * that it has disabled. */ modules = initialize_and_get_modules (tc); - CuAssertTrue (tc, lookup_module_with_name (tc, modules, "two.badname") != NULL); + CuAssertTrue (tc, lookup_module_with_name (tc, modules, "four") != NULL); finalize_and_free_modules (tc, modules); /* @@ -155,7 +155,7 @@ test_disable (CuTest *tc) p11_kit_set_progname ("test-disable"); modules = initialize_and_get_modules (tc); - CuAssertTrue (tc, lookup_module_with_name (tc, modules, "two.badname") == NULL); + CuAssertTrue (tc, lookup_module_with_name (tc, modules, "four") == NULL); finalize_and_free_modules (tc, modules); p11_kit_set_progname (NULL); -- 1.7.10.4