Issue 126106
Summary Test LlvmLibcFILETest.SimpleFileOperations fails due to file descriptor assertion
Labels bug, libc
Assignees
Reporter alanzhao1
    Repro steps:

```
$ cmake ../runtimes -GNinja \
 -DLLVM_ENABLE_RUNTIMES="libc;compiler-rt" \
  -DCMAKE_BUILD_TYPE=Debug \
  -DCMAKE_CXX_COMPILER=clang++ \
  -DCMAKE_C_COMPILER=clang \
 -DLLVM_LIBC_FULL_BUILD=ON \
  -DLLVM_LIBC_INCLUDE_SCUDO=ON \
 -DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON \
 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF \
 -DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF
$ ninja check-libc
```

Result:
```
[530/2361] Running unit test libc.test.src.stdio.fileop_test.__unit__
FAILED: libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fileop_test.__unit__ /usr/local/google/home/ayzhao/src/llvm-project/build-libc/libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.fileop_test.__unit__
cd /usr/local/google/home/ayzhao/src/llvm-project/build-libc/libc/test/src/stdio && /usr/local/google/home/ayzhao/src/llvm-project/build-libc/libc/test/src/stdio/libc.test.src.stdio.fileop_test.__unit__.__build__
[==========] Running 3 tests from 1 test suite.
[ RUN      ] LlvmLibcFILETest.SimpleFileOperations
/usr/local/google/home/ayzhao/src/llvm-project/libc/test/src/stdio/fileop_test.cpp:34: FAILURE
      Expected: __llvm_libc_20_0_0_git::fileno(file)
      Which is: 5
To be equal to: 3
      Which is: 3
[  FAILED  ] LlvmLibcFILETest.SimpleFileOperations
```

Looking at the [code](https://github.com/llvm/llvm-project/blob/16f7e961c600986de7814822fd118f431e0bb433/libc/test/src/stdio/fileop_test.cpp#L32-L34) the test opens a file and assert that its file descriptor is equal to the hardcoded value 3. This seems to be a brittle assertion as it makes assumptions about the test's process environment.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to