<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/115108>115108</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [mlir] `Target/LLVM/./MLIRTargetLLVMTests/failed_to_discover_tests_from_gtest` unittest failed when `LLVM_LINK_LLVM_DYLIB` is enabled
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          zhaoqi5
      </td>
    </tr>
</table>

<pre>
    If turning on `LLVM_LINK_LLVM_DYLIB` while building llvm and mlir, a mlir unittest will fail when`ninja check-mlir`.

```
: CommandLine Error: Option 'enable-branch-hint' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
llvm-lit: /home/zhaoqi/llvm-upstream/llvm/utils/lit/lit/formats/googletest.py:38: warning: unable to discover google-tests in '/home/zhaoqi/llvm-upstream/_build/tools/mlir/unittests/Target/LLVM/./MLIRTargetLLVMTests': Command '['/home/zhaoqi/llvm-upstream/_build/tools/mlir/unittests/Target/LLVM/./MLIRTargetLLVMTests', '--gtest_list_tests', '--gtest_filter=-*DISABLED_*']' died with <Signals.SIGABRT: 6>.. Process output: b''
FAIL: MLIR-Unit :: Target/LLVM/./MLIRTargetLLVMTests/failed_to_discover_tests_from_gtest (2639 of 2685)
******************** TEST 'MLIR-Unit :: Target/LLVM/./MLIRTargetLLVMTests/failed_to_discover_tests_from_gtest' FAILED ********************

********************
********************
Failed Tests (1):
  MLIR-Unit :: Target/LLVM/./MLIRTargetLLVMTests/failed_to_discover_tests_from_gtest
```

If turn off `LLVM_LINK_LLVM_DYLIB`, the test can pass.

platform: x86_64 Linux
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVU2P2zYT_jX0ZWCBolaydNDBXlsvjNdpCq9boCeBkiiJKUW6JLXO9tcXQznNBgiCoNugAE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