mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-13 22:23:45 +00:00
Fix lx_hybrid_ctors test for Ubuntu 11.10
On Ubuntu 11.10 the host library created for the 'lx_hybrid_ctors' test doesn't get loaded, because the test object in the library is not being used by the application. This commit fixes the problem by having the application call a dummy function in the library. Fixes #120.
This commit is contained in:
parent
77a7207b42
commit
c29b5f7da3
@ -14,6 +14,8 @@
|
||||
|
||||
#include <base/printf.h>
|
||||
|
||||
#include "testlib.h"
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
@ -23,16 +25,27 @@ struct Testapp_testclass
|
||||
{
|
||||
Genode::printf("Global static constructor of Genode application called\n");
|
||||
}
|
||||
|
||||
void dummy() { }
|
||||
};
|
||||
|
||||
|
||||
Testapp_testclass testapp_testclass;
|
||||
extern Testlib_testclass testlib_testobject;
|
||||
|
||||
Testapp_testclass testapp_testobject;
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("--- lx_hybrid global static constructor test ---\n");
|
||||
|
||||
/*
|
||||
* Call a dummy function on each test object to make sure that the
|
||||
objects don't get optimized out.
|
||||
*/
|
||||
testlib_testobject.dummy();
|
||||
testapp_testobject.dummy();
|
||||
|
||||
printf("--- returning from main ---\n");
|
||||
|
||||
return 0;
|
||||
|
@ -13,12 +13,16 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
struct Testlib_testclass
|
||||
{
|
||||
Testlib_testclass()
|
||||
{
|
||||
printf("[init -> test-lx_hybrid_ctors] Global static constructor of host library called.\n");
|
||||
}
|
||||
};
|
||||
#include "testlib.h"
|
||||
|
||||
Testlib_testclass testlib_testclass;
|
||||
|
||||
Testlib_testclass::Testlib_testclass()
|
||||
{
|
||||
printf("[init -> test-lx_hybrid_ctors] Global static constructor of host library called.\n");
|
||||
}
|
||||
|
||||
|
||||
void Testlib_testclass::dummy() { }
|
||||
|
||||
|
||||
Testlib_testclass testlib_testobject;
|
||||
|
18
base-linux/src/test/lx_hybrid_ctors/testlib.h
Normal file
18
base-linux/src/test/lx_hybrid_ctors/testlib.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* \brief Test if global static constructors in host shared libs get called
|
||||
* \author Christian Prochaska
|
||||
* \date 2011-11-24
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2012 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
struct Testlib_testclass
|
||||
{
|
||||
Testlib_testclass();
|
||||
void dummy();
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user