[LLVMbugs] [Bug 15217] New: unit tests mistakenly linking to installed (not built) shared libraries at run time on darwin

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 8 14:20:16 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15217

            Bug ID: 15217
           Summary: unit tests mistakenly linking to installed (not built)
                    shared libraries at run time on darwin
           Product: Test Suite
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: lit
          Assignee: unassignedbugs at nondot.org
          Reporter: fang at csl.cornell.edu
                CC: daniel at zuster.org, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Mis-linking at run time is causing many unit tests to fail.
Build of r174335 on powerpc-darwin8, cmake+shared.
Diagnosis follows.

[fangism:src/LLVM-svn/gcc40-cmake-build] fang% bin/llvm-lit -s -v
--filter=ScalarEvol test/Unit
FAIL: LLVM-Unit ::
Analysis/Debug//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Debug/AnalysisTests/ScalarEvolutionsTest.SCEVUnknownRAUW
(4 of 6)
******************** TEST 'LLVM-Unit ::
Analysis/Debug//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Debug/AnalysisTests/ScalarEvolutionsTest.SCEVUnknownRAUW'
FAILED ********************
Note: Google Test filter = ScalarEvolutionsTest.SCEVUnknownRAUW
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from ScalarEvolutionsTest
[ RUN      ] ScalarEvolutionsTest.SCEVUnknownRAUW
dyld: lazy symbol binding failed: Symbol not found:
__ZN4llvm14GlobalVariableC1ERNS_6ModuleEPNS_4TypeEbNS_11GlobalValue12LinkageTypesEPNS_8ConstantERKNS_5TwineEPS0_NS0_15ThreadLocalModeEj
  Referenced from:
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Debug/AnalysisTests
  Expected in:
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMCore.dylib

dyld: Symbol not found:
__ZN4llvm14GlobalVariableC1ERNS_6ModuleEPNS_4TypeEbNS_11GlobalValue12LinkageTypesEPNS_8ConstantERKNS_5TwineEPS0_NS0_15ThreadLocalModeEj
  Referenced from:
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Debug/AnalysisTests
  Expected in:
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMCore.dylib


********************
FAIL: LLVM-Unit ::
Analysis/Release//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests/ScalarEvolutionsTest.SCEVUnknownRAUW
(5 of 6)
******************** TEST 'LLVM-Unit ::
Analysis/Release//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests/ScalarEvolutionsTest.SCEVUnknownRAUW'
FAILED ********************
Note: Google Test filter = ScalarEvolutionsTest.SCEVUnknownRAUW
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from ScalarEvolutionsTest
[ RUN      ] ScalarEvolutionsTest.SCEVUnknownRAUW
dyld: lazy symbol binding failed: Symbol not found:
__ZN4llvm14GlobalVariableC1ERNS_6ModuleEPNS_4TypeEbNS_11GlobalValue12LinkageTypesEPNS_8ConstantERKNS_5TwineEPS0_bj
  Referenced from:
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests
  Expected in:
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMCore.dylib

dyld: Symbol not found:
__ZN4llvm14GlobalVariableC1ERNS_6ModuleEPNS_4TypeEbNS_11GlobalValue12LinkageTypesEPNS_8ConstantERKNS_5TwineEPS0_bj
  Referenced from:
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests
  Expected in:
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMCore.dylib


********************
FAIL: LLVM-Unit ::
Analysis/Release//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests/ScalarEvolutionsTest.SCEVMultiplyAddRecs
(6 of 6)
******************** TEST 'LLVM-Unit ::
Analysis/Release//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests/ScalarEvolutionsTest.SCEVMultiplyAddRecs'
FAILED ********************
Note: Google Test filter = ScalarEvolutionsTest.SCEVMultiplyAddRecs
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from ScalarEvolutionsTest
[ RUN      ] ScalarEvolutionsTest.SCEVMultiplyAddRecs

********************
Testing Time: 103.69s
********************
Failing Tests (3):
    LLVM-Unit ::
Analysis/Debug//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Debug/AnalysisTests/ScalarEvolutionsTest.SCEVUnknownRAUW
    LLVM-Unit ::
Analysis/Release//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests/ScalarEvolutionsTest.SCEVMultiplyAddRecs
    LLVM-Unit ::
Analysis/Release//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests/ScalarEvolutionsTest.SCEVUnknownRAUW

  Expected Passes    : 3
  Unexpected Failures: 3


Those undefined symbols:
[fangism:~] fang% echo
__ZN4llvm14GlobalVariableC1ERNS_6ModuleEPNS_4TypeEbNS_11GlobalValue12LinkageTypesEPNS_8ConstantERKNS_5TwineEPS0_bj
| c++filt
llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*, bool,
llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable*, bool, unsigned int)
[fangism:~] fang% echo
__ZN4llvm14GlobalVariableC1ERNS_6ModuleEPNS_4TypeEbNS_11GlobalValue12LinkageTypesEPNS_8ConstantERKNS_5TwineEPS0_NS0_15ThreadLocalModeEj
| c++filt
llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*, bool,
llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable*, llvm::GlobalVariable::ThreadLocalMode, unsigned int)

Those symbols are expected in libLLVMCore.dylib, but the recently built version
contains slightly different symbols, due to an API change:

% nm lib/libLLVMCore.dylib | c++filt | grep GlobalVariable::GlobalVariable
000e2474 T llvm::GlobalVariable::GlobalVariable(llvm::Type*, bool,
llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable::ThreadLocalMode, unsigned int, bool)
000e27ac T llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*,
bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable*, llvm::GlobalVariable::ThreadLocalMode, unsigned int,
bool)
000e2610 T llvm::GlobalVariable::GlobalVariable(llvm::Type*, bool,
llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable::ThreadLocalMode, unsigned int, bool)
000e29b0 T llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*,
bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable*, llvm::GlobalVariable::ThreadLocalMode, unsigned int,
bool)

According to svn annotate, API change was introduced by r174295 (mgottesman),
in the constructors of GlobalVariable.

The undefined symbols referenced are however defined in the *installed*
llvm/clang from an earlier revision:

% nm /usr/local/experimental/llvm/lib/libLLVMCore.dylib | c++filt | grep
GlobalVariable::GlobalVariable
000e2710 T llvm::GlobalVariable::GlobalVariable(llvm::Type*, bool,
llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable::ThreadLocalMode, unsigned int)
000e2a20 T llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*,
bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable*, llvm::GlobalVariable::ThreadLocalMode, unsigned int)
000e2898 T llvm::GlobalVariable::GlobalVariable(llvm::Type*, bool,
llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable::ThreadLocalMode, unsigned int)
000e2c10 T llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*,
bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable*, llvm::GlobalVariable::ThreadLocalMode, unsigned int)


When I run just the unit test executable by itself, the tests pass:
[fangism:src/LLVM-svn/gcc40-cmake-build] fang% unittests/Analysis/AnalysisTests 
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from ScalarEvolutionsTest
[ RUN      ] ScalarEvolutionsTest.SCEVUnknownRAUW
[       OK ] ScalarEvolutionsTest.SCEVUnknownRAUW (705 ms)
[ RUN      ] ScalarEvolutionsTest.SCEVMultiplyAddRecs
[       OK ] ScalarEvolutionsTest.SCEVMultiplyAddRecs (86 ms)
[----------] 2 tests from ScalarEvolutionsTest (792 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (794 ms total)
[  PASSED  ] 2 tests.

To confirm, shared library linking was bound to the build-area, not the
install-location:
[fangism:src/LLVM-svn/gcc40-cmake-build] fang% otool -L
unittests/Analysis/AnalysisTests
unittests/Analysis/AnalysisTests:
       
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMAnalysis.dylib
(compatibility version 0.0.0, current version 0.0.0)
       
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMTarget.dylib
(compatibility version 0.0.0, current version 0.0.0)
        /Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMCore.dylib
(compatibility version 0.0.0, current version 0.0.0)
        /Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMMC.dylib
(compatibility version 0.0.0, current version 0.0.0)
       
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMObject.dylib
(compatibility version 0.0.0, current version 0.0.0)
       
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMSupport.dylib
(compatibility version 0.0.0, current version 0.0.0)
        /Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libgtest.dylib
(compatibility version 0.0.0, current version 0.0.0)
       
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libgtest_main.dylib
(compatibility version 0.0.0, current version 0.0.0)
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
version 7.4.0)
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version
1.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 88.1.12)

Something with llvm-lit is hacking the environment to use the installed
locations for the unit tests, which is incorrect.

In IRC, gribozavr pointed out that this might be attributed to the last lines
of test/Unit/lit.cfg.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130208/8763de7b/attachment.html>


More information about the llvm-bugs mailing list