Linux下testngpp测试用例共享库加载不成功问题

能加载成功的,无论是带.so还是不带.so,都能加载成功。

不能加载成功的,带.so提示文件不存在,不带.so提示链接的符号找不到。

之前,类似加载.so不成功的问题,通过比较各版本的代码,最终修改一个返回引用类型变量的处理,问题解决(参见后面的修改),但最后这个so加载不成功却不好定位了,也没有一个加载成功的代码版本可比较。

jelly@jelly-linux:~/Programming/mockcpp/build_tests/ut$ ../../build_testngpp/src/runner/testngpp-runner libmockcpp-ut-TestApiHook -L"../../build_testngpp/src/listeners" -l"testngppstdoutlistener -c -f"
loading testngppstdoutlistener ... OK

[  ERROR   ] runner: test suite "libmockcpp-ut-TestApiHook" can't be loaded : libmockcpp-ut-TestApiHook.so: undefined symbol: _ZN11TestApiHook1aE
no test to run!

===========================RESULT===========================
 loaded suites: 0 unloadable suites: 1
 load success rate: 0%

(0s 3502us)

jelly@jelly-linux:~/Programming/mockcpp/build_tests/ut$ ../../build_testngpp/src/runner/testngpp-runner libmockcpp-ut-TestApiHook.so -L"../../build_testngpp/src/listeners" -l"testngppstdoutlistener -c -f"
loading testngppstdoutlistener ... OK

[  ERROR   ] runner: test suite "libmockcpp-ut-TestApiHook.so" can't be loaded : libmockcpp-ut-TestApiHook.so.so: cannot open shared object file: No such file or directory
no test to run!

===========================RESULT===========================
 loaded suites: 0 unloadable suites: 1
 load success rate: 0%

(0s 5026us)
jelly@jelly-linux:~/Programming/mockcpp/build_tests/ut$ ../../build_testngpp/src/runner/testngpp-runner libmockcpp-ut-TestAny -L"../../build_testngpp/src/listeners" -l"testngppstdoutlistener -c -f"
loading testngppstdoutlistener ... OK


-----------------------SUITE: TestAny-----------------------

(TestAny)
.........................................

===========================RESULT===========================
[    OK    ] 41 cases from 1 suites ran successfully.

(0s 13594us)
jelly@jelly-linux:~/Programming/mockcpp/build_tests/ut$ 
jelly@jelly-linux:~/Programming/mockcpp/build_tests/ut$ ../../build_testngpp/src/runner/testngpp-runner libmockcpp-ut-TestAny.so -L"../../build_testngpp/src/listeners" -l"testngppstdoutlistener -c -f"
loading testngppstdoutlistener ... OK


-----------------------SUITE: TestAny-----------------------

(TestAny)
.........................................

===========================RESULT===========================
[    OK    ] 41 cases from 1 suites ran successfully.

(0s 10708us)
jelly@jelly-linux:~/Programming/mockcpp/build_tests/ut$ 
附录:

6个so无法加载的问题修改如下:

--- include/mockcpp/ChainableMockMethod.h      (版本 432)
+++ include/mockcpp/ChainableMockMethod.h      (工作副本)
@@ -63,13 +63,14 @@
                  , p01, p02, p03, p04, p05, p06
                  , p07, p08, p09, p10, p11, p12
                  , resultProvider);
+            return getResult(result, resultProvider);
      }
      catch(std::exception& ex)
      {
        MOCKCPP_REPORT_FAILURE(ex.what());
      }
-      extern const Any& result;
-      return getResult(result, resultProvider);
+//      extern const Any& result;
+//      return getResult(result, resultProvider);
  }








本文转sinojelly51CTO博客,原文链接:http://blog.51cto.com/sinojelly/390383,如需转载请自行联系原作者

上一篇:再谈包访问权限 子类为何不能使用父类protected方法


下一篇:Linux下动态共享库 连接和加载路径