brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 45dc36f Raw
29 lines · plain
1// Test that compiling using a PCH doesn't leak file descriptors.2// https://bugs.chromium.org/p/chromium/issues/detail?id=9242253//4// This test uses ulimit.5// UNSUPPORTED: system-windows6//7// Set up source files. lib/lib.h includes lots of lib*.h files in that dir.8// client.c includes lib/lib.h, and also the individual files directly.9//10// RUN: rm -rf %t11// RUN: mkdir %t12// RUN: cd %t13// RUN: mkdir lib14// RUN: %python -c "from pathlib import Path; list(map(lambda i: Path(f'lib/lib{i}.h').touch(), range(1, 301)))"15// RUN: %python -c "for i in range(1, 301): print(f'#include \"lib{i}.h\"')" > lib/lib.h16// RUN: echo "#include \"lib/lib.h\"" > client.c17// RUN: %python -c "for i in range(1, 301): print(f'#include \"lib/lib{i}.h\"')" > client.c18//19// We want to verify that we don't hold all the files open at the same time.20// This is important e.g. on mac, which has a low default FD limit.21// RUN: ulimit -n 10022//23// Test without PCH.24// RUN: %clang_cc1 -fsyntax-only -Ilib/ client.c25//26// Test with PCH.27// RUN: %clang_cc1 -emit-pch -o pch -Ilib/ client.c28// RUN: %clang_cc1 -include-pch pch -Ilib/ client.c -fsyntax-only29