Commit Graph

440 Commits

Author SHA1 Message Date
Paul Kirth
c4131cb56c [Fuchsia][cmake] Avoid referencing cxx_shared in compiler-rt (#112257)
After https://github.com/llvm/llvm-project/pull/80007 Fuchsia builds are
now always building cxx_shared for arm64 and x64 Linux. Ultimately, this
is because the LIBCXX_ENABLE_SHARED is not used in compiler-rt to select
the correct libc++ target, and because cxx_shared is now always defined,
it is selected as a dependency when building runtimes tests.

---------

Co-authored-by: Petr Hosek <phosek@google.com>
2024-10-14 14:41:19 -07:00
NAKAMURA Takumi
851817b494 fuzzer/strncmp.test: Increase iteration to 20M.
I saw cases that this finised before finding `BINGO`, possibly
insufficient number of iteration. In my case, 11,067,133 satisfied.

So, increase the number for now. This change may increase the duration
of this in failing (`BINGO` not found) case.
2024-10-14 18:34:36 +09:00
Petr Hosek
eb0e4b1415 [Fuzzer] Passthrough zlib CMake paths into the test (#107926)
We shouldn't assume that we're using system zlib installation.
2024-09-09 19:21:59 -07:00
Harini0924
3b79468c07 [compiler-rt][test] Add REQUIRES: shell to focus-function.test with for-loop (#106150)
This patch adds `REQUIRES: shell` to the `focus-function.test` because
the lit internal shell does not support the for loop syntax. This will
make the test file unsupported when running llvm-lit with its internal
shell implementation, which is enabled by turning on the
`LIT_USE_INTERNAL_SHELL=1`.

fixes: #106111
2024-08-26 20:36:46 -07:00
Harini0924
9007864f72 [compiler-rt][tests] Fix env command not found errors with lit internal shell (#105879)
This patch addresses an issue where the `LIBFUZZER_OOP_TARGET`
environment variable was causing "command not found" errors in the
`out-of-process-fuzz` test when running with the
`LIT_USE_INTERNAL_SHELL=1 ninja check-compiler-rt` command.
Error displayed:
```
# .---command stderr------------
# | 'LIBFUZZER_OOP_TARGET=./oop-target > /dev/null 2>&1 ': command not found
# `-----------------------------
# error: command failed with exit status: 127
```
The lit internal shell was not correctly interpreting the command
redirection and environment variable assignment in a single line,
leading to the failure.

In this patch the test was updated to use `env` for setting the
`LIBFUZZER_OOP_TARGET` environment variable. This change ensures that
the command is properly recognized and executed within the internal
shell environment. The output of the fuzzing process was captured in a
temporary file instead of redirecting it directly to `/dev/null`,
allowing for more controlled output management. Finally, the results
from running `oop-target` on all corpus files are now appended to ensure
that every output is thoroughly checked by FileCheck. The `RUN` line
sets the `LIBFUZZER_OOP_TARGET` using `env`, runs the `oop-fuzzer` with
specific options and uses the seed files from `OOP_CORPUS/seed` to
initiate the fuzzing process.

This change is relevant for enabling the lit internal shell by default,
as outlined in [[RFC] Enabling the Lit Internal Shell by
Default](https://discourse.llvm.org/t/rfc-enabling-the-lit-internal-shell-by-default/80179)
2024-08-26 15:56:22 -07:00
Harini0924
2d37e48e24 [compiler-rt][test] Add REQUIRES: shell in tests that use the ulimit command (#105339)
This patch adds the `REQUIRES: shell` directive to six test files that
use the `ulimit` command, ensuring these tests are only run in
environments where a full POSIX-compliant shell is available. The lit
internal shell does not use or support the `ulimit` command, which
causes failures when running tests with `LIT_USE_INTERNAL_SHELL=1 ninja
check-compiler-rt`
Specifically, one of the errors encountered is: 
```
# RUN: at line 4
ulimit -s 1000
# executed command: ulimit -s 1000
# .---command stderr------------
# | 'ulimit': command not found
# `-----------------------------
# error: command failed with exit status: 127
```
Since, the lit internal shell doesn't support `ulimit`, adding this
requirement prevents these tests from failing in the lit internal shell,
thereby improving the reliability of the test suite in environments
where the full shell is not available.

This change is relevant for [[RFC] Enabling the Lit Internal Shell by
Default](https://discourse.llvm.org/t/rfc-enabling-the-lit-internal-shell-by-default/80179/3)
fixes:  #102398
2024-08-26 12:02:16 -07:00
Harini0924
42d06b8e55 [compiler-rt][test] Change tests to remove the use of unset command in lit internal shell (#104880)
This patch rewrites tests to remove the use of the `unset` command,
which is not supported in the lit internal shell. The tests now use the
`env -u` to unset environment variables.

The `unset` command is used in shell environments to remove the
environment variable. However, because the lit internal shell does not
support the `unset` command, using it in tests would result in errors or
other unexpected behavior. To overcome this limitation, the tests have
been updated to use the `env -u` command instead. `env -u` is supported
by lit and effectively removes specified environment variables. This
allows the tests to achieve the same goal of unsetting environment
variables while ensuring compatibility with the lit internal shell.

This change is relevant for [[RFC] Enabling the Lit Internal Shell by
Default](https://discourse.llvm.org/t/rfc-enabling-the-lit-internal-shell-by-default/80179/3)
Fixes: #102397
2024-08-22 14:39:23 -07:00
Connie Zhu
f25e6515aa [compiler-rt][test] Added REQUIRES:shell to fuzzer test with for-loop (#105557)
This patch makes the features_dir.test file require a shell when
running. This will make the test file unsupported when running llvm-lit
with its internal shell implementation, which is enabled by turning on
the LIT_USE_INTERNAL_SHELL environment variable. Lit's internal shell
currently does not support for-loop syntax.
2024-08-21 17:26:16 -07:00
Harini0924
03d51019d0 Add REQUIRES: shell to Tests Requiring Full Shell Functionality with lit Internal Shell (#102988)
This patch adds the `REQUIRES: shell` directive to compiler-rt's fuzzer
tests that require full shell functionality when using the lit internal
shell. These tests depend on features such as background processes,
signal handling, and session management, which are not supported by
lit's internal shell. The addition of this directive ensures that these
tests are only executed in environments that provide the necessary shell
capabilities.

**Details of the Change:**
The following considerations were addressed:
- **Background Processes (`&`):** The tests run commands in the
background using the `&` operator, which allows the shell to execute
commands concurrently without waiting for each one to finish. In a
standard Unix-like shell, this is a common feature that facilitates
multitasking. However, lit's internal shell does not fully support
background job control, which can lead to unpredictable behavior or test
failures. Without proper handling of background processes, subsequent
commands that depend on the status of these processes may not function
correctly.
- **Signal Handling (`kill -SIGUSR1`, `kill -SIGUSR2`, `kill
-SIGINT`):** These tests involve sending specific signals like
`SIGUSR1`, `SIGUSR2`, and `SIGINT` to running processes. These signals
are used to trigger certain behaviors in the processes, such as pausing,
resuming, or terminating. However, lit's internal shell may not handle
these signals properly—it might not send the signal correctly, or the
process might not respond as it should. This could lead to the test
failing, not because the process is incorrect, but because the shell
didn't manage the signals as required.
- **Session Management (`setsid`):** The tests use `setsid` to create
new sessions, detaching processes from their controlling terminal and
isolating them into their own process groups. However, the internal
shell in lit does not support session management features like `setsid`,
this can't correctly isolate and manage processes as required by these
tests.

This change is relevant for enabling the lit internal shell by default,
as outlined in [[RFC] Enabling the Lit Internal Shell by
Default](https://discourse.llvm.org/t/rfc-enabling-the-lit-internal-shell-by-default/80179)
2024-08-13 08:21:16 -07:00
Vitaly Buka
d4b28fb751 [compiler-rt] Cleanup use of COMPILER_RT_INCLUDE_TESTS (#98246)
1. Move checks into parent test/CMakeLists.txt
2. COMPILER_RT_INCLUDE_TESTS disable both lit and
   gtests. Before it was very inconsistent between
   sanitizers.
2024-07-18 18:33:24 -07:00
Vitaly Buka
4283f1ad18 [NFC][fuzzer] Remove unhelpful lit notes
They are not actionable.
2024-07-17 17:23:50 -07:00
Mitch Phillips
bb90e2ed87 [libfuzzer] Fix -runs=X flaky test (fuzzer-finalstats.test) (#96914)
Disables LSan in order to remove a 1% flake rate in this test.
There's some logic in LeakSanitizer and its integration into libFuzzer
that will disable LSan and re-run the input. This only happens when more
malloc()s are detected than free()s. Under high system load, this
appears to be possible as the "more mallocs than frees" is dependent on
walltime. In these instances, the number of runs ends up being `n + 1`,
which is undesirable.
2024-07-09 11:23:49 +02:00
David Spickett
765e2f9a8d [compiler-rt][fuzzer][test] Disable finalstats test
This test is flaky and has been reporting irrelevant failures to PRs
on Github for example:
https://github.com/llvm/llvm-project/pull/97829#issuecomment-2214030135
https://lab.llvm.org/buildbot/#/builders/66/builds/1159

Adding this to https://github.com/llvm/llvm-project/issues/97712.
2024-07-09 08:47:54 +00:00
David Spickett
d6af73e9fb [compiler-rt][Fuzzer] Disable fuzzer-leak test
This has been flaky and reporting a lot of unrelated failures to PRs.

See https://github.com/llvm/llvm-project/issues/97712
2024-07-04 11:04:13 +00:00
Michael Kruse
a35ac42fac [compiler-rt] Revise IDE folder structure (#89753)
Update the folder titles for targets in the monorepository that have not
seen taken care of for some time. These are the folders that targets are
organized in Visual Studio and XCode
(`set_property(TARGET <target> PROPERTY FOLDER "<title>")`)
when using the respective CMake's IDE generator.

 * Ensure that every target is in a folder
 * Use a folder hierarchy with each LLVM subproject as a top-level folder
 * Use consistent folder names between subprojects
 * When using target-creating functions from AddLLVM.cmake, automatically
deduce the folder. This reduces the number of
`set_property`/`set_target_property`, but are still necessary when
`add_custom_target`, `add_executable`, `add_library`, etc. are used. A
LLVM_SUBPROJECT_TITLE definition is used for that in each subproject's
root CMakeLists.txt.
2024-06-04 09:26:45 +02:00
Alexander Richardson
dfafe3822b Reland "[compiler-rt] Allow running tests without installing first"
Currently, the testsuite uses the default runtimes path to find the
runtimes libraries which may or may not match the just-built runtimes.
This change uses the `-resource-dir` flag for clang whenever
`COMPILER_RT_TEST_STANDALONE_BUILD_LIBS` is set to ensure that we are
actually testing the currently built libraries rather than the ones
bundled with `${COMPILER_RT_TEST_COMPILER}`.

The existing logic works fine when clang and compiler-rt share the same
build directory ``-DLLVM_ENABLE_PROJECTS=clang;compiler-rt`, but when
building compiler-rt separately we need to tell the compiler used for
the tests where it can find the just-built libraries.

This reduces the fixes check-all failures to one in my configuration:
```
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -G Ninja
-DCMAKE_C_COMPILER=$HOME/output/upstream-llvm/bin/clang
-DCMAKE_CXX_COMPILER=$HOME/output/upstream-llvm/bin/clang++
-DCOMPILER_RT_INCLUDE_TESTS=ON
-DLLVM_EXTERNAL_LIT=$HOME/build/upstream-llvm-project-build/bin/llvm-lit
-DLLVM_CMAKE_DIR=$HOME/output/upstream-llvm
-DCOMPILER_RT_DEBUG=OFF
-S $HOME/src/upstream-llvm-project/compiler-rt
-B $HOME/src/upstream-llvm-project/compiler-rt/cmake-build-all-sanitizers
```

This relands the previous PR with fixes for Windows.
Depends on https://github.com/llvm/llvm-project/pull/88074 to be merged
first for GCC buildbots.

Pull Request: https://github.com/llvm/llvm-project/pull/88075
2024-04-12 13:20:30 -07:00
Saiyedul Islam
2084a07087 Revert "[compiler-rt] Allow running tests without installing first"
This reverts commit c91254db1d.

It was throwing error:
 g++: error: unrecognized command line option ‘-resource-dir=
2024-04-08 03:35:23 -04:00
Alexander Richardson
c91254db1d [compiler-rt] Allow running tests without installing first
Currently, the testsuite uses the default runtimes path to find the
runtimes libraries which may or may not match the just-built runtimes.
This change uses the `-resource-dir` flag for clang whenever
`COMPILER_RT_TEST_STANDALONE_BUILD_LIBS` is set to ensure that we are
actually testing the currently built libraries rather than the ones
bundled with `${COMPILER_RT_TEST_COMPILER}`.

The existing logic works fine when clang and compiler-rt share the same
build directory ``-DLLVM_ENABLE_PROJECTS=clang;compiler-rt`, but when
building compiler-rt separately we need to tell the compiler used for
the tests where it can find the just-built libraries.

This reduces the fixes check-all failures to one in my configuration:
```
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -G Ninja
-DCMAKE_C_COMPILER=$HOME/output/upstream-llvm/bin/clang
-DCMAKE_CXX_COMPILER=$HOME/output/upstream-llvm/bin/clang++
-DCOMPILER_RT_INCLUDE_TESTS=ON
-DLLVM_EXTERNAL_LIT=$HOME/build/upstream-llvm-project-build/bin/llvm-lit
-DLLVM_CMAKE_DIR=$HOME/output/upstream-llvm
-DCOMPILER_RT_DEBUG=OFF
-S $HOME/src/upstream-llvm-project/compiler-rt
-B $HOME/src/upstream-llvm-project/compiler-rt/cmake-build-all-sanitizers
```

Reviewed By: vitalybuka, delcypher, MaskRay

Pull Request: https://github.com/llvm/llvm-project/pull/83088
2024-04-07 09:50:06 -07:00
Usama Hameed
65e5391657 Pass the linker version to libfuzzer tests on darwin (#87719)
The HOST_LINK_VERSION is a hardcoded string in Darwin clang that detects
the linker version at configure time. The driver uses this information
to build the correct set of arguments for the linker. This patch detects
the linker version again during compiler-rt configuration and passes it
to the libfuzzer tests. This allows a clang built on a machine with a
new linker to run compiler-rt tests on a machine with an old linker.

rdar://125932376
2024-04-05 14:48:16 -07:00
Alexander Richardson
ba2dc2953c [compiler-rt] Don't check COMPILER_RT_STANDALONE_BUILD for test deps
With https://github.com/llvm/llvm-project/pull/83088, we now need the
runtimes to be built before running test if
COMPILER_RT_TEST_STANDALONE_BUILD_LIBS is true, since otherwise we
get failures running `ninja check-all` such as the following:
```
/usr/bin/ld: cannot find .../compiler-rt/cmake-build-all-sanitizers/lib/linux/libclang_rt.fuzzer-x86_64.a: No such file or directory
/usr/bin/ld: cannot find .../compiler-rt/cmake-build-all-sanitizers/lib/linux/libclang_rt.xray-x86_64.a: No such file or directory
/usr/bin/ld: cannot find .../compiler-rt/cmake-build-all-sanitizers/lib/linux/libclang_rt.xray-basic-x86_64.a: No such file or directory
/usr/bin/ld: cannot find .../compiler-rt/cmake-build-all-sanitizers/lib/linux/libclang_rt.xray-fdr-x86_64.a: No such file or directory
```

This is a follow-up to 058e9b03 which started removing these checks
and it should make it easier to stop forcing COMPILER_RT_STANDALONE_BUILD
for runtimes builds in the future.

Reviewed By: vitalybuka

Pull Request: https://github.com/llvm/llvm-project/pull/83651
2024-03-18 16:48:37 -07:00
Vitaly Buka
14ca0ac915 [fuzzer,test] Remove old debug logging 2024-01-19 23:27:32 -08:00
Alexandre Ganea
0f62e7ea2c [compiler-rt] Fix fuzzer tests on Windows
This fixes a link-time mismatch between the clang_rt.fuzzer-x86_64.lib
and the fuzzer tests, which happen to build with -fsanitize=address.

See: https://learn.microsoft.com/en-us/cpp/sanitizers/error-container-overflow?view=msvc-170
2024-01-17 07:23:57 -05:00
Ami-zhang
75b0a99668 [test][compiler-rt] Mark several tests as UNSUPPORTED on LoongArch (#69699) 2023-10-27 16:52:10 +08:00
Wu Yingcong
db4ba210ca [fuzzer] Relax the FileCheck string for test fuzzer-custommutator.test (#66343)
The FileCheck string `LLVMFuzzerCustomMutatorLongSequence: {{.*}} MS:
{{[0-9]*}} {{(([a-zA-Z]*-){11,})}} {{.*}}` is too restrictive and may
fail the test in some case.

If we look at the commit that added this
check(66df98945e),
This check is for printing out the long mutation sequence, such as this
one
```
#53552  REDUCE cov: 6 ft: 6 corp: 5/9b lim: 4096 exec/s: 0 rss: 37Mb L: 2/3 MS: 54 ChangeByte-PersAutoDict-ChangeBit-ChangeBinInt-ChangeBit-ChangeBit-ChangeByte-CMP-EraseBytes-EraseBytes-CrossOver-InsertRepeatedBytes-ChangeByte-EraseBytes-InsertRepeatedBytes-ShuffleBytes-ChangeByte-ShuffleBytes-ChangeBit-CrossOver-ChangeBit-ShuffleBytes-ChangeBinInt-ShuffleBytes-EraseBytes-InsertByte-Custom-ShuffleBytes-CopyPart-InsertRepeatedBytes-PersAutoDict-InsertRepeatedBytes-ChangeByte-CrossOver-CrossOver-PersAutoDict-PersAutoDict-EraseBytes-ChangeBit-CopyPart-ChangeByte-CopyPart-InsertRepeatedBytes-CrossOver-CrossOver-CrossOver-CrossOver-ShuffleBytes-EraseBytes-InsertByte-InsertRepeatedBytes-CrossOver-EraseBytes-Custom- DE: "\377\377"-"\001\000"-"\001\000"-"\000\000\000\000\000\000\000\000"-"\001\000\000\000"-
```

But if we look at the code doing the printing
```cpp
void MutationDispatcher::PrintMutationSequence(bool Verbose) {
  Printf("MS: %zd ", CurrentMutatorSequence.size());
  size_t EntriesToPrint =
      Verbose ? CurrentMutatorSequence.size()
              : std::min(kMaxMutationsToPrint, CurrentMutatorSequence.size());
  for (size_t i = 0; i < EntriesToPrint; i++)
    Printf("%s-", CurrentMutatorSequence[i].Name);
  if (!CurrentDictionaryEntrySequence.empty()) {
    Printf(" DE: ");
    EntriesToPrint = Verbose ? CurrentDictionaryEntrySequence.size()
                             : std::min(kMaxMutationsToPrint,
                                        CurrentDictionaryEntrySequence.size());
    for (size_t i = 0; i < EntriesToPrint; i++) {
      Printf("\"");
      PrintASCII(CurrentDictionaryEntrySequence[i]->GetW(), "\"-");
    }
  }
}
```

We can see that the `DE: XXX` is not always printed. So the following
output is possible(and is from real-life failure), notince the missing
of `DE: XXX`.
```
#13613  NEW    cov: 5 ft: 5 corp: 4/6b lim: 4096 exec/s: 0 rss: 32Mb L: 2/2 MS: 27 InsertByte-ChangeBinInt-ChangeBinInt-CrossOver-ShuffleBytes-ChangeBit-EraseBytes-ShuffleBytes-InsertByte-InsertRepeatedBytes-CopyPart-InsertByte-ChangeByte-ChangeBit-InsertByte-CrossOver-EraseBytes-CopyPart-ShuffleBytes-EraseBytes-InsertByte-InsertRepeatedBytes-CrossOver-CrossOver-ShuffleBytes-ChangeBit-Custom-
#13765  ......
```
This output is totally legit and will fail that check.

So I remove the check for the following strings, I think `MS: {{[0-9]*}}
{{(([a-zA-Z]*-){11,})}}` is sufficient for checking the long mutation
sequence. This should help resolve the flaky failure of
fuzzer-custommutator.test.
2023-09-20 15:19:25 -07:00
Vitaly Buka
469c3e77cb [test][fuzzer] Deflake fork_corpus_groups.test 2023-09-01 01:11:58 -07:00
Vitaly Buka
99e5f6066e [test][fuzzer] Deflake fork.test 2023-09-01 00:57:35 -07:00
Wu, Yingcong
9c0302a772 [fuzzer,CMake] Group fuzzer lit test into one check-fuzzer
For now check-fuzzer is just a cmake target that depends
on different check-fuzzer-xxx lit test targets. This causes
check-fuzzer get seperate lit test results like this:

```
********************
********************
Failed Tests (1):
  libFuzzer :: fuzzer-flags.test

Testing Time: 19.80s
  Unsupported      :   7
  Passed           : 128
  Expectedly Failed:   3
  Failed           :   1
make[3]: *** [projects/compiler-rt/test/fuzzer/CMakeFiles/check-fuzzer-default-x86_64.dir/build.make:71: projects/compiler-rt/test/fuzzer/CMakeFiles/check-fuzzer-default-x86_64] Error 1
make[2]: *** [CMakeFiles/Makefile2:36745: projects/compiler-rt/test/fuzzer/CMakeFiles/check-fuzzer-default-x86_64.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
--

********************
********************
Failed Tests (1):
  libFuzzer :: fuzzer-flags.test

Testing Time: 24.33s
  Unsupported:  21
  Passed     : 117
  Failed     :   1
make[3]: *** [projects/compiler-rt/test/fuzzer/CMakeFiles/check-fuzzer-default-i386.dir/build.make:71: projects/compiler-rt/test/fuzzer/CMakeFiles/check-fuzzer-default-i386] Error 1
make[2]: *** [CMakeFiles/Makefile2:36697: projects/compiler-rt/test/fuzzer/CMakeFiles/check-fuzzer-default-i386.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:36608: projects/compiler-rt/test/fuzzer/CMakeFiles/check-fuzzer.dir/rule] Error 2
make: *** [Makefile:10719: check-fuzzer] Error 2
```

This patch replaces check-fuzzer-xxx lit test sub-targets with one big check-fuzzer lit test target, just like sanitizer_common test.

```
********************
********************
Failed Tests (2):
  libFuzzer :: fuzzer-flags.test
  libFuzzer :: fuzzer-flags.test

Testing Time: 25.10s
  Unsupported      :  28
  Passed           : 303
  Expectedly Failed:   3
  Failed           :   2
make[3]: *** [projects/compiler-rt/test/fuzzer/CMakeFiles/check-fuzzer.dir/build.make:71: projects/compiler-rt/test/fuzzer/CMakeFiles/check-fuzzer] Error 1
make[2]: *** [CMakeFiles/Makefile2:36618: projects/compiler-rt/test/fuzzer/CMakeFiles/check-fuzzer.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:36625: projects/compiler-rt/test/fuzzer/CMakeFiles/check-fuzzer.dir/rule] Error 2
make: *** [Makefile:10719: check-fuzzer] Error 2
```

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D158717
2023-08-28 14:45:01 -07:00
Wu, Yingcong
ed5acb1425 [fuzzer,CMake] Add config name for fuzzer lit test
Add config name for fuzzer lit test, to make it easier to identify failures are with which config.

Before this change, same lit tests with different configs will share the same test name.
```
********************
Failed Tests (2):
  libFuzzer :: fuzzer-flags.test
  libFuzzer :: fuzzer-flags.test
```
Actually this is a failure of two lit tests(two configs of the same test).

With this change, the names will be different.
```
********************
Failed Tests (2):
  libFuzzer-i386-default-Linux ::fuzzer-flags.test
  libFuzzer-x86_64-default-Linux :: fuzzer-flags.test
```

Reviewed By: MaskRay, vitalybuka

Differential Revision: https://reviews.llvm.org/D158696
2023-08-28 14:39:45 -07:00
Fangrui Song
307e19784a [test] Make fuzzer/value-profile-div.test x86 specific
The test requires that an integer division by zero causes a trap, leading to a
signal like SIGFPE. This is the case on x86. On many other architectures, such
as Arm (unless software division is used and `__aeabi_idiv0` is patched),
Power, RISC-V, LoongArch, there is no trap. Therefore, it's more appropriate to
invert the condition to run the test.

Reviewed By: Ami-zhang

Differential Revision: https://reviews.llvm.org/D155644
2023-07-18 22:11:27 -07:00
Tobias Hieta
f98ee40f4b [NFC][Py Reformat] Reformat python files in the rest of the dirs
This is an ongoing series of commits that are reformatting our
Python code. This catches the last of the python files to
reformat. Since they where so few I bunched them together.

Reformatting is done with `black`.

If you end up having problems merging this commit because you
have made changes to a python file, the best way to handle that
is to run git checkout --ours <yourfile> and then reformat it
with black.

If you run into any problems, post to discourse about it and
we will try to help.

RFC Thread below:

https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

Reviewed By: jhenderson, #libc, Mordante, sivachandra

Differential Revision: https://reviews.llvm.org/D150784
2023-05-25 11:17:05 +02:00
Roy Sundahl
b62c39f9ef [fuzzer][test] Disable big-file-copy.test for everything but macOS
This test is heavy on test resources and involves moving a large 2GB+ file
across an ssh connection when testing on remote devices. Exclude all tests
except for macOS testing (on host). Remote device testing for macOS may
eventually cause a problem on macOS as well w/o better handling of tests
that require more resource/time than we currently handle.
    Introduced by:
        https://reviews.llvm.org/D146189
    Subsequent exclusion of all but darwin by:
        https://reviews.llvm.org/D147094
    Subsequent exclusion of tvOS and watchOS by:
        https://reviews.llvm.org/D147502
    Subsequent exclusion of all but macOS...

rdar://107570309

Reviewed By: yln, thetruestblue

Differential Revision: https://reviews.llvm.org/D148727
2023-04-20 12:19:30 -07:00
Antoine Moynault
7dbf5ce538 [fuzzer][test] Disable noasan-strncmp test for AArch64
This test fails on several aarch64 bots
  clang-aarch64-lld-2stage ( https://lab.llvm.org/buildbot/#/builders/185/builds/3525 )
  clang-aarch64-full-2stage ( https://lab.llvm.org/buildbot/#/builders/179/builds/5904 )
  clang-aarch64-sve-vla ( https://lab.llvm.org/buildbot/#/builders/197/builds/4519 )
Disable it while this is analyzed.

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D148332
2023-04-14 15:33:11 +00:00
Roy Sundahl
5c950a3127 [fuzzer][test] Avoid big-file-copy.test on memory constrained devices
The test "big-file-copy.test" introduced in D146189 and constrained to darwin by
D147094, is by this differential further constrained to only those devices with
sufficient resources. Also correct the test to read the environment variable
"result" from the same shell in which it was stored (which may differ on devices).

Reviewed By: thetruestblue

Differential Revision: https://reviews.llvm.org/D147502
2023-04-04 11:02:53 -07:00
Roy Sundahl
4c55fd974b [fuzzer] Limit big-file-copy.test to darwin only
This test has to be limited to darwin due to multiple failures on other
platforms for multple reasons. (Timeout, puts() limit, etc.). This
commit modifies D146189.

Reviewed By: NoQ

Differential Revision: https://reviews.llvm.org/D147094
2023-03-28 17:23:22 -07:00
Roy Sundahl
90b4d1bcb2 [fuzzer] Use puts() rather than printf() in CopyFileToErr()
CopyFileToErr() uses Printf("%s", ...) which fails with a negative size on
files >2Gb (Its path is through var-args wrappers to an unnecessary "%s"
expansion and subject to int overflows) Using puts() in place of printf()
bypasses this path and writes the string directly to stderr. This avoids the
present loss of data when a crashed worker has generated >2Gb of output.

rdar://99384640

Reviewed By: yln, rsundahl

Differential Revision: https://reviews.llvm.org/D146189
2023-03-28 14:19:35 -07:00
Wu, Yingcong
c2df1d8a6d [libfuzzer] add test of cov file-id in control file
There is test for ft file-id in control file, but no test for cov line.
Without the test, a invalid cov file-id would cause crash.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D145672
2023-03-22 22:55:48 -07:00
Matthew Voss
d02ff3d578 Revert "[fuzzer] Use puts() rather than printf() in CopyFileToErr()"
This reverts commit 03aa02adb0.

Reverting due to bot failures:
https://lab.llvm.org/buildbot/#/builders/247/builds/2653
2023-03-17 16:00:56 -07:00
Roy Sundahl
03aa02adb0 [fuzzer] Use puts() rather than printf() in CopyFileToErr()
CopyFileToErr() uses Printf("%s", ...) which fails with a negative size on
files >2Gb (Its path is through var-args wrappers to an unnecessary "%s"
expansion and subject to int overflows) Using puts() in place of printf()
bypasses this path and writes the string directly to stderr. This avoids the
present loss of data when a crashed worker has generated >2Gb of output.

rdar://99384640

Reviewed By: yln

Differential Revision: https://reviews.llvm.org/D146189
2023-03-17 09:08:40 -07:00
Wu, Yingcong
67f5b05cdc Add test for Flags.data_flow_trace
`CollectDataFlow()` uses `Flags.collect_data_flow` and
`Flags.data_flow_trace` at the same time. But in the null check before
the invocation, only `Flags.collect_data_flow` is checked, and there is
no other method to make sure `Flags.data_flow_trace` is not null, so
adding a null check for `Flags.data_flow_trace`.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D145040
2023-03-07 22:18:29 -08:00
Paul Robinson
8e60061290 [compiler-rt] Simplify lit test thumb checks 2022-12-21 05:33:32 -08:00
Paul Robinson
5bdb9254d9 [fuzzer] Fix UNSUPPORTED criteria for two tests
Fuzzer might decide on a target arch different from the triple.
2022-12-16 12:48:16 -08:00
Paul Robinson
8a86860207 [fuzzer] Convert tests to check 'target=...'
Part of the project to eliminate special handling for triples in lit
expressions.
2022-12-16 11:41:53 -08:00
Youling Tang
3ba498d145 [fuzzer][test] Add #include <cstdint> for gcc-13
See https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes.

Reviewed By: SixWeining

Differential Revision: https://reviews.llvm.org/D137696
2022-11-10 13:44:11 +08:00
Roy Sundahl
9a82412f82 [test][fuzzer] XFAIL tvOS tests pending investigation. (rdar://99981102)
These four tests are failing on tvOS devices (not simulators) so  XFAIL
them for now for CI and investigate further.

rdar://99981102

Differential Revision: https://reviews.llvm.org/D133963
2022-09-15 13:40:28 -07:00
Roy Sundahl
17dde371e7 [test] [fuzzer] Enable tests for iossim, disable for ios (update2)
The fuzzer tests cross_over.test and merge-control-file.test are not handled
correctly on ios device testing. On-device testing requires the macros %t, %s,
etc. to be expanded for a different default directory than when testing on host.

rdar://99889376

Differential Revision: https://reviews.llvm.org/D133811
2022-09-13 16:19:08 -07:00
Florian Mayer
a51d19636c [ASan] Fix libfuzzer test 2022-09-06 13:37:35 -07:00
Kostya Serebryany
92fb310151 [libFuzzer] Extend the fuzz target intarface to allow -1 return value.
With this change, fuzz targets may choose to return -1
to indicate that the input should not be added to the corpus
regardless of the coverage it generated.

Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D128749
2022-06-30 13:21:27 -07:00
Andrew Turner
95141aa9cb Fix TableLookupTest on FreeBSD
As with Linux placce the Counters array in the __libfuzzer_extra_counters
section. This fixes the test on FreeBSD.

Reviewed by: vitalybuka

Differential Revision: https://reviews.llvm.org/D125902
2022-06-09 09:24:09 -04:00
Mitch Phillips
80ac0b9bc8 Fix up fuzzing test on Windows.
3bd112c720 fixed the fuzzing test on Linux, which, after
https://reviews.llvm.org/D125933, has one less branch. Turns out, on
Windows, that it still has the extra branch. I'm guessing that's because
exit() isn't known to be noreturn on Windows or something.

Either way, just make the test more tolerant.
2022-05-20 11:27:08 -07:00
Mitch Phillips
3bd112c720 Update fuzzing test to comply with new optimisation.
https://reviews.llvm.org/D125933 improved some of LLVM's handling of
binary ORs, which meant we have one less conditional branch, because the
'if (Size > 5 && Data[5] == 'R')' and 'if (bits == 63)' branches are now
correctly folded.
2022-05-20 11:01:31 -07:00