1 /*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64
4 for INTEL64(R), AMD64(R)
6 Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved.
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
11 1. Redistributions of source code must retain the above copyright notice,
12 this list of conditions and the following disclaimer.
13 2. Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the
15 documentation and/or other materials provided with the distribution.
17 THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY
18 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27 OF THE POSSIBILITY OF SUCH DAMAGE.
29 DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/
31 /* File Info -----------------------------------------------------------
35 ----------------------------------------------------------------------*/
37 #define DRD64_SRC_TEST_LIBBROWNIE_SEARCHLIB
38 #include"test_libbrownie.h"
39 #include"drd64_libbrownie.h"
41 /*----------------------------------------------------------------------
43 ----------------------------------------------------------------------*/
44 void Test_LibBrownie_SearchLib_test01_sub(
45 int i_testid, char *pstr_env_ldlibpath, char *pstr_ldhints, char *pstr_solibname)
48 char str_resolvpath[DRD64_MAX_PATH];
51 i_result = LibBrownie_GetLibraryPath(
52 str_resolvpath, pstr_solibname, ".:..:../testdata", NULL,
53 pstr_env_ldlibpath, pstr_ldhints );
54 CU_ASSERT( 0x00 < i_result );
56 printf(" SearchLib Test1%02d: %s [%d]\n", i_testid, str_resolvpath, i_result );
61 /*----------------------------------------------------------------------
63 ----------------------------------------------------------------------*/
64 void Test_LibBrownie_SearchLib_test04_sub(
65 int i_testid, char *pstr_env_ldlibpath, char *pstr_ldhints, char *pstr_solibname)
68 char str_resolvpath[DRD64_MAX_PATH];
71 i_result = LibBrownie_GetLibraryPath(
72 str_resolvpath, pstr_solibname, NULL, ".:..:../testdata",
73 pstr_env_ldlibpath, pstr_ldhints );
74 CU_ASSERT( 0x00 < i_result );
76 printf(" SearchLib Test4%02d: %s [%d]\n", i_testid, str_resolvpath, i_result );
81 /*----------------------------------------------------------------------
83 ----------------------------------------------------------------------*/
84 void Test_LibBrownie_SearchLib_test05_sub(
85 int i_testid, char *pstr_env_ldlibpath, char *pstr_ldhints, char *pstr_solibname)
88 char str_resolvpath[DRD64_MAX_PATH];
91 i_result = LibBrownie_GetLibraryPath(
92 str_resolvpath, pstr_solibname, NULL, NULL,
93 pstr_env_ldlibpath, pstr_ldhints );
94 CU_ASSERT( 0x00 < i_result );
96 printf(" SearchLib Test5%02d: %s [%d]\n", i_testid, str_resolvpath, i_result );
101 /*----------------------------------------------------------------------
102 ----------------------------------------------------------------------*/
103 void Test_LibBrownie_SearchLib_test00_001(void)
107 char *pstr_env_ldlibpath;
109 pstr_ldhints = LibBrownie_GetLoadLibraryPath( LIBBROWNIE_LDHINTS_ELF64 );
110 CU_ASSERT( NULL != pstr_ldhints );
112 pstr_env_ldlibpath = getenv( LIBBROWNIE_SEARCHLIB_ENV_LDLIBPATH );
114 i_result = LibBrownie_Init();
115 CU_ASSERT( i_result == 0x00 );
117 Test_LibBrownie_SearchLib_test01_sub( 1, pstr_env_ldlibpath, pstr_ldhints, "libsotest.so" );
119 Test_LibBrownie_SearchLib_test04_sub( 1, pstr_env_ldlibpath, pstr_ldhints, "libsonodbg.so" );
121 Test_LibBrownie_SearchLib_test05_sub( 1, pstr_env_ldlibpath, pstr_ldhints, "libc.so.7" );
122 Test_LibBrownie_SearchLib_test05_sub( 2, pstr_env_ldlibpath, pstr_ldhints, "libbz2.so.4" );
123 Test_LibBrownie_SearchLib_test05_sub( 3, pstr_env_ldlibpath, pstr_ldhints, "libX11.so.6" );
124 Test_LibBrownie_SearchLib_test05_sub( 4, pstr_env_ldlibpath, pstr_ldhints, "libLTO.so" );
127 LibBrownie_FreeLoadLibraryPath( LIBBROWNIE_LDHINTS_ELF64 );
136 /*----------------------------------------------------------------------
137 ----------------------------------------------------------------------*/
138 DRD64_TEST_LIBBROWNIE_SEARCHLIB_EXTERN
140 Test_LibBrownie_SearchLib(
143 CU_pSuite pt_brownie;
145 pt_brownie = CU_add_suite( "LibBrownie_SearchLib", NULL, NULL );
147 CU_add_test( pt_brownie, "LibBrownie_SearchLib_test00_001",
148 Test_LibBrownie_SearchLib_test00_001 );
154 /* EOF of drd64_.c ----------------------------------- */