Bug 44740

Summary: 1 test failed by make check
Product: p11-glue Reporter: Cesar Romani <romani_c>
Component: p11-kitAssignee: Stef Walter <stefw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: cjtuckerjr0, doctordos, stefw
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on: 52158    
Bug Blocks:    
Attachments: Use correct shared library extension on windows
Use Windows thread ids instead of handles for comparisons
Don't rely on loading order for duplicate modules
Fix warning on windows
Initialize mutexes correctly in mock module
Test results after patching

Description Cesar Romani 2012-01-12 10:52:28 UTC
Making check in p11-kit
make[1]: Entering directory `/home/caesar/p11-kit-0.10/build/p11-kit'
make[1]: Nothing to be done for `check'.
make[1]: Leaving directory `/home/caesar/p11-kit-0.10/build/p11-kit'
Making check in tools
make[1]: Entering directory `/home/caesar/p11-kit-0.10/build/tools'
make[1]: Nothing to be done for `check'.
make[1]: Leaving directory `/home/caesar/p11-kit-0.10/build/tools'
Making check in tests
make[1]: Entering directory `/home/caesar/p11-kit-0.10/build/tests'
make  check-TESTS
make[2]: Entering directory `/home/caesar/p11-kit-0.10/build/tests'
.............

OK (13 tests)

004060AA setting
PASS: hash-test.exe
........

OK (8 tests)

PASS: ptr-array-test.exe
..............

OK (14 tests)

PASS: conf-test.exe
.......................................

OK (39 tests)

PASS: uri-test.exe
.......

OK (7 tests)

PASS: pin-test.exe
FAIL: test-init.exe
============================================================================
1 of 6 tests failed
Please report to https://bugs.freedesktop.org/enter_bug.cgi?product=p11-glue
============================================================================
make[2]: *** [check-TESTS] Error 1
make[2]: Leaving directory `/home/caesar/p11-kit-0.10/build/tests'
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `/home/caesar/p11-kit-0.10/build/tests'
make: *** [check-recursive] Error 1
Comment 1 Stef Walter 2012-01-24 06:14:05 UTC
Could you run the tests/test-init.exe again and see what it does? Does it crash or what happens? Does it produce any output?
Comment 2 Lucian Jalba 2012-06-05 13:34:07 UTC
(In reply to comment #1)
> Could you run the tests/test-init.exe again and see what it does? Does it crash
> or what happens? Does it produce any output?

I second that problem. Just compiled p11-kit-0.12 from source using mingw+msys (gcc 4.6.2) on Windows XP: ./configure --prefix=/mingw, make, make check. It fails at test-init.exe with a messagebox: 

The exception unknown software exception (0xc0000029) occurred in the application at location 0x7c9502cc.

The last output from test-init.exe is:
p11-kit: p11-kit initialization called recursively
p11-kit: p11-kit initialization called recursively

I looked a bit through the code and it seems that this sequence

for (i = 0; i < num_threads; i++) {
		ret = _p11_thread_create (&threads[i], initialization_thread, tc);
		CuAssertIntEquals (tc, 0, ret);
		CuAssertTrue (tc, threads[i] != 0);
	}

from test_threaded_initialization in test-init.c is generating the error.

Also, any output placed after this loop will be visible in the console AFTER the error appears (the program keeps running a little bit after the error is displayed)
Comment 3 Lucian Jalba 2012-07-16 17:17:05 UTC
I wanted to test again with version 0.13, but it seems that it won't even compile anymore (i double checked version 0.12 - it compiles and crashes during testing as before)

The error I get from 0.13 when I try to run make:
pin.c: In function 'p11_kit_pin_file_callback':
pin.c:476:12: error: 'EOVERFLOW' undeclared (first use in this function)
pin.c:476:12: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [libp11_kit_la-pin.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2


I also tried to cross-compile 0.12 on ubuntu, with mingw32 and the problem persists. During testing (with WINE), i can see the following output to the console:
p11-kit: p11-kit initialization called recursively
p11-kit: p11-kit initialization called recursively
wine: Unhandled exception 0xc0000029 at address 0x7bc3e8a8 (thread 003a), starting debugger...
Can't attach process 0037: error 5
.F

There was 1 failure:
1) test_threaded_initialization: test-init.c:164: assert failed

!!!FAILURES!!!
Runs: 2 Passes: 1 Fails: 1
Comment 4 Stef Walter 2012-07-17 06:35:04 UTC
Created attachment 64293 [details] [review]
Use correct shared library extension on windows

 * The windows shared libraries have the .dll extension
 * This means we also need separate directories for the test module
   configs on win32

https://bugzilla.gnome.org/show_bug.cgi?id=44740
Comment 5 Stef Walter 2012-07-17 06:35:07 UTC
Created attachment 64294 [details] [review]
Use Windows thread ids instead of handles for comparisons

 * It seems that the HANDLE's returned from GetCurrentThread
   are often equal for two threads. GetCurrentThreadID doesn't
   have this problem.
 * Separate our cross platform thread_t and thread_id_t types
   even though on unix they're the same thing.

https://bugzilla.gnome.org/show_bug.cgi?id=44740
Comment 6 Stef Walter 2012-07-17 06:35:10 UTC
Created attachment 64295 [details] [review]
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
Comment 7 Stef Walter 2012-07-17 06:35:13 UTC
Created attachment 64296 [details] [review]
Fix warning on windows

https://bugzilla.gnome.org/show_bug.cgi?id=44740
Comment 8 Stef Walter 2012-07-17 06:35:16 UTC
Created attachment 64297 [details] [review]
Initialize mutexes correctly in mock module

https://bugzilla.gnome.org/show_bug.cgi?id=44740
Comment 9 Stef Walter 2012-07-17 06:36:09 UTC
Attached some fixes. This also depends on bug #52158 to keep things simple.
Comment 10 Stef Walter 2012-07-17 15:26:34 UTC
Lucian, do these patches fix the issue for you? If you like, I could make you a git branch, or tarball for testing.

If you have time I'd also appreciate you looking over them to make sure I didn't miss anything obvious.
Comment 11 Lucian Jalba 2012-07-18 22:24:43 UTC
Created attachment 64368 [details]
Test results after patching

I finally managed to apply the patches (wasn't sure about the branch to which I should apply them).

The good news: everything compiles again
The bad news: there is another test failing (in a more controlled manner)

Details: autogen.sh fails on windows (see attachment), so I ran it on linux and then used only configure on windows. The attachment contains the output captured during compile & test (both on windows and ubuntu, using mingw32).

I did managed to have a look at the changes, but from where I'm standing (the average programmer) I simply can't comment on them.
Comment 12 Stef Walter 2012-07-26 10:25:07 UTC
*** Bug 52500 has been marked as a duplicate of this bug. ***
Comment 13 Stef Walter 2012-07-26 10:38:54 UTC
Okay, I merged the patches.

As far as the test failure, could you comment out this line in conf-test.c and run the tests again? 

      p11_kit_be_quiet ();

And then attach the make check output? There should be more lines of output.
Comment 14 steve 2012-08-03 17:30:59 UTC
(In reply to comment #12)
> *** Bug 52500 has been marked as a duplicate of this bug. ***

I tried building the latest git source today and the errors are gone.  Thank you!
Comment 15 Lucian Jalba 2012-09-06 19:36:47 UTC
(In reply to comment #13)
> Okay, I merged the patches.
> 
> As far as the test failure, could you comment out this line in conf-test.c and
> run the tests again? 
> 
>       p11_kit_be_quiet ();
> 
> And then attach the make check output? There should be more lines of output.

Hi Stef,

I just tested the version 0.14 package and everything seems ok on Windows/MinGW GCC 4.7.0: configure, compile and the magic phrase "All 8 tests passed"

I'd say that this one is resolved for me, with the following remarks:

- there is a warning in ../common/compat.c:78:1: function declaration isn't a prototype (I don't really care about it anyway)
- some absolute paths seems to be hardcoded at some point - 4 of the tests will fail if i change the p11-kit folder location after running configure & make (I hope this is the intended functionality)

Let me know if you need more info, or if you want me to generate the make check output for the previous version.
Comment 16 Stef Walter 2013-02-12 14:59:06 UTC
(In reply to comment #15)
> (In reply to comment #13)
> > Okay, I merged the patches.
> > 
> > As far as the test failure, could you comment out this line in conf-test.c and
> > run the tests again? 
> > 
> >       p11_kit_be_quiet ();
> > 
> > And then attach the make check output? There should be more lines of output.
> 
> Hi Stef,
> 
> I just tested the version 0.14 package and everything seems ok on
> Windows/MinGW GCC 4.7.0: configure, compile and the magic phrase "All 8
> tests passed"
> 
> I'd say that this one is resolved for me, with the following remarks:
> 
> - there is a warning in ../common/compat.c:78:1: function declaration isn't
> a prototype (I don't really care about it anyway)

That's a really odd warning, since we're declaring an extern variable. Unless somehow Windows defines __argv as a macro?

> - some absolute paths seems to be hardcoded at some point - 4 of the tests
> will fail if i change the p11-kit folder location after running configure &
> make (I hope this is the intended functionality)

Yes, this is pretty common among autotools based projects.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.