Commit Graph

3030 Commits

Author SHA1 Message Date
Greg Fitzgerald 320713ffbe Add target flags to ubsan tests
llvm-svn: 208746
2014-05-14 00:46:01 +00:00
Greg Fitzgerald 1402830dc5 Add %run to tests that used %T/name.exe
llvm-svn: 208744
2014-05-14 00:32:15 +00:00
Alexey Samsonov 5716928ae2 [TSan] Build TSan-instrumented version of libcxx and use it in lit tests.
TSan can produce false positives in code that uses C++11 threading,
as it doesn't see synchronization inside standard library. See
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-February/035408.html
for an example of such case.

We may build custom TSan-instrumented version libcxx to fight with that.
This change adds build rules for libcxx_tsan and integrates it into
testing infrastructure.

llvm-svn: 208737
2014-05-13 22:30:16 +00:00
Alexander Potapenko 4a6cac4382 [libsanitizer] Use internal_fork() to spawn the symbolizer process.
This should fix https://code.google.com/p/thread-sanitizer/issues/detail?id=61

llvm-svn: 208707
2014-05-13 16:17:54 +00:00
Evgeniy Stepanov 5680a26b0b [msan] Better open_memstream support.
Move fflush and fclose interceptors to sanitizer_common.
Use a metadata map to keep information about the external locations
that must be updated when the file is written to.

llvm-svn: 208676
2014-05-13 08:36:31 +00:00
Alexey Samsonov 79b8fb5d2c Mark ptrace test as Linux-specific
llvm-svn: 208643
2014-05-13 00:02:18 +00:00
Alexey Samsonov b51d6081f3 Restrict the set of sanitizers that should run tests from test/sanitizer_common
llvm-svn: 208639
2014-05-12 22:48:29 +00:00
Greg Fitzgerald fb1d83a978 Add %run to new lit test
llvm-svn: 208624
2014-05-12 20:17:14 +00:00
Kostya Serebryany 118d469660 [asan] one more attempt to enable lsan by default (PR19521)
llvm-svn: 208545
2014-05-12 12:49:48 +00:00
Sergey Matveev aeb18fc787 [asan] Further fix the test from r208333.
Remove a debug print and some copypasta.

llvm-svn: 208535
2014-05-12 10:33:31 +00:00
Kostya Serebryany d7992fc921 [asan] fix a self deadlock when printing stats; add a relevant test, cleanup that test while at it to remove linux/darwin differences. Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=306
llvm-svn: 208525
2014-05-12 08:01:51 +00:00
Duncan P. N. Exon Smith b6bd2f6cf7 InstrProf: Pacify buildbots after r208460
llvm-svn: 208462
2014-05-09 23:47:49 +00:00
Duncan P. N. Exon Smith 238137294f InstrProf: Test the functions in the runtime
Check that the profile runtime works as expected.  This tests the
functions that are meant to be available to advanced users.

In particular, check that the `atexit()` hook can be disabled by
defining a custom `__llvm_profile_runtime` variable, that the libc
dependencies are optional, and that the various functions for writing
out files work for basic cases.

llvm-svn: 208460
2014-05-09 23:14:58 +00:00
Alexey Samsonov 0bef819f9f [Sanitizer] Add the machinery to run the same test under several sanitizers
llvm-svn: 208378
2014-05-09 00:28:18 +00:00
Alexey Samsonov 6dd8dfb1c4 [Sanitizer] Move lit config for sanitizer_common unit tests under Unit/ dir for consistency.
llvm-svn: 208373
2014-05-08 23:53:02 +00:00
Alexey Samsonov 35744c4753 Fixup for r208066. Properly get values of PTRACE_GETREGSET/PTRACE_SETREGSET.
llvm-svn: 208363
2014-05-08 22:11:20 +00:00
Alexey Samsonov 0b9b36623a Fixup test added in r208333
llvm-svn: 208356
2014-05-08 20:21:11 +00:00
Sergey Matveev 76e02e90c5 [ASan] Fix coverage behavior when a PC belongs to an unknown address range.
This happens, e.g., when coverage data is collected for a module which is then
dlclose()'d. Currently this causes CovDump() to ignore all PCs that are greater
than the unrecognized PC. In other words, unloading a module causes ASan to
silently ignore any coverage data for modules loaded at higher addresses.
Instead we should just skip the unrecognized PCs.

llvm-svn: 208333
2014-05-08 16:09:54 +00:00
Evgeniy Stepanov c5e51926dc [msan] Intercept strxfrm.
llvm-svn: 208303
2014-05-08 12:04:01 +00:00
Evgeniy Stepanov 9c20cb1a7c [msan] Fix potential infinite recursion in a test.
If printf is intercepted (it is not atm), REAL(printf) call in the interceptor
would get redirected back to my_lgamma, resulting in infinite recursion.

llvm-svn: 208294
2014-05-08 09:37:36 +00:00
Evgeniy Stepanov 5ee9fd5f45 [asan] Update tests for r208290.
sprintf output buffer is now always sanitized.

llvm-svn: 208291
2014-05-08 09:24:53 +00:00
Greg Fitzgerald dda7f8cfd0 [asan] fix i386 tests broken from r207707
llvm-svn: 208240
2014-05-07 19:22:16 +00:00
Evgeniy Stepanov 55590227f8 [sanitizer] Intercept obstack.
llvm-svn: 208196
2014-05-07 11:50:56 +00:00
Evgeniy Stepanov 8dd62dc3be [msan] Fix __msan_check_mem_is_initialized and prettify its output.
llvm-svn: 208195
2014-05-07 11:50:14 +00:00
Kostya Serebryany 7a733480c8 [asan] introduce interface function __sanitizer_verify_contiguous_container to verify annotations in vector-like containers
llvm-svn: 208092
2014-05-06 14:41:01 +00:00
Evgeniy Stepanov 06475bf752 [msan] Fix print_shadow test.
llvm-svn: 208069
2014-05-06 08:15:50 +00:00
Kostya Serebryany 12963b54a8 [asan] disable GetKernelStartAddress as it misbehaves in schroot
llvm-svn: 207768
2014-05-01 16:20:23 +00:00
Greg Fitzgerald b8aae5405b Add %run to all lit tests
llvm-svn: 207709
2014-04-30 21:34:17 +00:00
Greg Fitzgerald 6759fd9fdd Allow any test to be executed via a %run command.
Configure %run with COMPILER_RT_EMULATOR:

  $ cmake -DCOMPILER_RT_EMULATOR="qemu-arm -L $SYSROOT"

llvm-svn: 207707
2014-04-30 21:32:30 +00:00
Evgeniy Stepanov fe250b0014 [msan] Prettify __msan_print_shadow.
Makes __msan_print_shadow output much more readable, adds origin info.

llvm-svn: 207622
2014-04-30 09:50:30 +00:00
Kostya Serebryany cacbac7ba9 [asan] fix a test
llvm-svn: 207417
2014-04-28 13:18:59 +00:00
Kostya Serebryany 4f9c31a2fa [asan] split detect_odr_violation into two: =2 detects all ODR violations, =1 detects only those where the variable sizes are different. BTW, the detector seems to be working well and finding nice bugs. Early adopters are welcome.
llvm-svn: 207415
2014-04-28 12:47:58 +00:00
Evgeniy Stepanov f3d5d119a8 [sanitizer] Intercept a bunch of stdio calls.
Add move fopen/freopen interceptors from TSan to common.

llvm-svn: 207224
2014-04-25 13:26:21 +00:00
Kostya Serebryany e91930a7e6 [asan] implement an experimental detector of ODR violations. Not tested yet outside of a tiny test, may need tuning.
llvm-svn: 207210
2014-04-25 08:58:28 +00:00
Dmitry Vyukov 56a18f02ea tsan: better reports for "read lock of a write locked mutex"
llvm-svn: 207209
2014-04-25 08:58:23 +00:00
Dmitry Vyukov e296164f77 tsan: improve "read unlock of a write locked mutex" report
llvm-svn: 207208
2014-04-25 08:21:30 +00:00
Dmitry Vyukov 66dbbbc47b tsan: fix tests
failure:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-centos-6.5/builds/3747/steps/test/logs/stdio

llvm-svn: 207207
2014-04-25 08:13:45 +00:00
Dmitry Vyukov 2c87108a42 tsan: better report for bad mutex unlocks
+ fixes crashes due to races on symbolizer, see
https://code.google.com/p/thread-sanitizer/issues/detail?id=55

llvm-svn: 207206
2014-04-25 07:55:11 +00:00
Dmitry Vyukov ea014b787a tsan: add new test for commit 207204 (forget to add new file)
llvm-svn: 207205
2014-04-25 07:49:36 +00:00
Peter Collingbourne 16f2f18105 Add user-defined callback on write() calls.
Add dfsan_set_write_callback(), which sets a callback to be invoked when
a write() call is invoked within DFSan instrumented code.

Patch by Sam Kerner!

Differential Revision: http://reviews.llvm.org/D3268

llvm-svn: 207131
2014-04-24 17:42:16 +00:00
Kostya Serebryany 7afc6b2c72 [asan] enable use_sigaltstack by default (this will provide verbose reports on stack-overflow instead of silently crashing with SEGV)
llvm-svn: 207099
2014-04-24 11:55:17 +00:00
Evgeniy Stepanov 5a7c364343 [msan] Disable chained origins in signal handlers.
StackDepot is not async-signal-safe; storing a new origin to it can deadlock.

llvm-svn: 206983
2014-04-23 14:01:57 +00:00
Dmitry Vyukov ac81ee5533 tsan: fix atexit handling after fork
fixes issue http://code.google.com/p/thread-sanitizer/issues/detail?id=57

llvm-svn: 206980
2014-04-23 13:42:16 +00:00
Kostya Serebryany 8cd3d27879 [asan] disable lsan back. :( -- It appears that quite a few lit tests have leaks and they were not covered by out buildbot
llvm-svn: 206955
2014-04-23 08:15:16 +00:00
Dmitry Vyukov b1edac069e tsan: more precise check for "app memory" in COMPAT mode
this fires when a user makes mmap with fixed address (see the test)

llvm-svn: 206952
2014-04-23 07:01:02 +00:00
Kostya Serebryany c9db838267 [asan] enable LeakSanitizer (LSan) by default in asan. This only affects Linux x86_64. LSan has been used in various projects for more than half a year and we now consider it quite stable to be on by default.
llvm-svn: 206896
2014-04-22 13:56:56 +00:00
Alexander Potapenko 6e647c13e4 [ASan] Fixed the expectation for Darwin memset test.
Added a comment about keeping the Linux/Darwin test versions in sync.

llvm-svn: 206881
2014-04-22 10:53:57 +00:00
Kostya Serebryany 26c4e96455 [sanitizer] enable check_printf by default for asan and tsan. We've been using this flag for a while and it seems to be stable enough for the rest of the world.
llvm-svn: 206872
2014-04-22 09:17:08 +00:00
Evgeniy Stepanov a7f9071f25 [sanitizer] Intercept tsearch.
llvm-svn: 206755
2014-04-21 14:21:51 +00:00
Dmitry Vyukov 5e52f3a142 tsan: deflake test
ocasionally it fails with a slightly different report:

WARNING: ThreadSanitizer: signal handler spoils errno (pid=3674)
     MyHandler(int, siginfo*, void*)
    ...
     __tsan_free_hook
     main signal_errno.cc:40
llvm-svn: 206754
2014-04-21 14:21:24 +00:00
Kostya Serebryany 38bb53b2c5 [asan] add a run-time flag detect_container_overflow=true/false
llvm-svn: 206753
2014-04-21 14:18:45 +00:00
Kostya Serebryany 632751539e [asan] add __asan_memset and friends
llvm-svn: 206748
2014-04-21 11:58:25 +00:00
Dmitry Vyukov 10d4b14a16 tsan: add benchmark that allows to investigate shadow memory consumption
llvm-svn: 206578
2014-04-18 10:37:39 +00:00
Kostya Serebryany 498b18a01e [asan] try to harden __tls_get_addr interceptor against signals (no good test still); update the comment in a test.
llvm-svn: 206367
2014-04-16 09:07:27 +00:00
Alexander Potapenko 65a6c57013 [ASan] Replace a CHECK for mmap_limit_mb with a RAW_CHECK.
In the case of a CHECK failure the program tries to fork and launch llvm-symbolizer,
but hangs in mz_force_lock because one of the allocator locks is already acquired.

llvm-svn: 206274
2014-04-15 11:36:18 +00:00
Kostya Serebryany b1232474b2 [asan] try fixing the mmap_limit_mb failure on buildbot (tests pass locally)
llvm-svn: 206262
2014-04-15 08:35:43 +00:00
Evgeniy Stepanov 81d80f7578 [asan] Fix mmap_limit_mb test to not use C++11.
llvm-svn: 206182
2014-04-14 15:37:02 +00:00
Evgeniy Stepanov 681016b2ea [asan] Do not use lambda in sanitizer lit tests.
We may be building with a very old C++ library.

llvm-svn: 206180
2014-04-14 15:19:07 +00:00
Kostya Serebryany bcfbea6d4e [asan] added internal flag mmap_limit_mb
llvm-svn: 206178
2014-04-14 14:51:01 +00:00
Kostya Serebryany 90527cb324 [asan] don't use bool in public interface, make sure the interface headers are usable in plain C
llvm-svn: 206160
2014-04-14 11:16:53 +00:00
Kostya Serebryany f694ab1f18 [asan] provide better reports for cases where memcpy/etc get negative size parameter. Also fix a typo found by Tetsuo Kiso
llvm-svn: 206158
2014-04-14 09:50:52 +00:00
Evgeniy Stepanov 77d8793fa6 [tsan] Fix output tests.
llvm-svn: 206031
2014-04-11 13:01:20 +00:00
Evgeniy Stepanov 652cbd7c15 [tsan] Fix false positive on xdr*_create.
llvm-svn: 206030
2014-04-11 12:29:24 +00:00
Evgeniy Stepanov 24c8d92fec [sanitizer] Intercept a subset of sunrpc interface (xdr_*).
llvm-svn: 205627
2014-04-04 14:51:23 +00:00
Alexey Samsonov 7dc3c0fb2b [ASan] Explicitly specify -ldl/-lpthread in RUN-lines where needed
llvm-svn: 205623
2014-04-04 12:24:46 +00:00
Dmitry Vyukov 1d66c4d5b7 tsan: improve error message in test
we've seen a flake on this test
next time it happens we will be able to gather some info

llvm-svn: 205619
2014-04-04 09:52:41 +00:00
Kostya Serebryany 9f20c9b17c [asan] fix a leak in __tls_get_addr handler; introduce a run-time flag to disable this handler completely; remove a workaround for a bug fixed in glibc
llvm-svn: 205617
2014-04-04 09:10:58 +00:00
Evgeniy Stepanov 6d8f71f928 Revert r205613.
llvm-svn: 205614
2014-04-04 08:58:16 +00:00
Evgeniy Stepanov fe82d5f849 [msan] Fix compilation of a disabled test.
llvm-svn: 205613
2014-04-04 08:39:50 +00:00
Evgeniy Stepanov 6cc687541f [msan] Add missing test for r205413.
llvm-svn: 205417
2014-04-02 12:38:13 +00:00
Duncan P. N. Exon Smith dd690a2ca4 InstrProfile: Use SANITIZER_COMMON_LIT_TEST_DEPS
Take advantage of the SANITIZER_COMMON_LIT_TEST_DEPS variable.

<rdar://problem/16458307>

llvm-svn: 205321
2014-04-01 16:05:15 +00:00
Duncan P. N. Exon Smith 48e24c7355 InstrProf: Turn on test for Linux
Enabling test/profile on Linux to get feedback from the buildbots.  I'm
hoping this just works...

<rdar://problem/16458307>

llvm-svn: 205319
2014-04-01 15:56:05 +00:00
Duncan P. N. Exon Smith a5f806e599 InstrProf: Remove LTO dependency from test
The -flto flag relies on linker features that are not available on all
platforms.

<rdar://problem/16458307>

llvm-svn: 205318
2014-04-01 15:29:27 +00:00
Joerg Sonnenberger 6530149704 Add support for IEEE754 quad precision comparison functions.
From GuanHong Liu.

Differential Revision: http://llvm-reviews.chandlerc.com/D2797

llvm-svn: 205312
2014-04-01 13:42:56 +00:00
Alexey Samsonov 56b6ee9833 [ASan] Optional support for dynamic ASan runtime on Linux.
Based on http://llvm-reviews.chandlerc.com/D3042 by Yuri Gribov!

llvm-svn: 205308
2014-04-01 13:16:30 +00:00
Alexey Samsonov 28f30b4176 [TSan] Make this test more portable
llvm-svn: 205300
2014-04-01 11:51:50 +00:00
Kostya Serebryany 432c46bf70 [sanitizer] one more stress test for the deadlock detector; this one stresses the slow path with a global lock
llvm-svn: 205299
2014-04-01 11:35:55 +00:00
Duncan P. N. Exon Smith da91cbdfa8 InstrProf: lit.cfg magic for running tests from source
Implement magic in compiler-rt to enable llvm-lit to be invoked on the
source tree in lib/profile.  This relies on a paired commit in the llvm
tree that exposes a new built-in parameter.

<rdar://problem/16458307>

llvm-svn: 205263
2014-03-31 23:14:28 +00:00
Duncan P. N. Exon Smith ae2f0bbcf1 InstrProf: Add simple compiler-rt test
Add the test infrastructure for testing lib/profile and a single test.
This initial commit only enables the tests on Darwin, but they'll be
enabled on Linux soon after.

<rdar://problem/16458307>

llvm-svn: 205256
2014-03-31 22:45:37 +00:00
Evgeniy Stepanov 3c95744de8 [msan] Remove an extra top frame from track-origins=2 reports.
llvm-svn: 205192
2014-03-31 14:18:55 +00:00
Alexander Potapenko 0315b52444 [TSan] Follow-up for r205175: typo fix in the test.
llvm-svn: 205176
2014-03-31 10:51:13 +00:00
Evgeniy Stepanov 92bee36b3e [sanitizer] Intercept rand_r.
llvm-svn: 205001
2014-03-28 11:21:45 +00:00
Evgeniy Stepanov 2e972f63b5 [sanitizer] Intercept mktime.
llvm-svn: 204994
2014-03-28 09:02:57 +00:00
Evgeniy Stepanov 7b44e1ad42 [sanitizer] Intercept ftime.
llvm-svn: 204991
2014-03-28 08:33:32 +00:00
Evgeniy Stepanov a6eb1bb59e [sanitizer] Intercept __bzero on Mac.
This should make memset_test pass on Mac.

llvm-svn: 204929
2014-03-27 14:20:34 +00:00
Evgeniy Stepanov 89602651e8 [msan] Implement __msan_set_death_callback.
llvm-svn: 204926
2014-03-27 14:04:58 +00:00
Evgeniy Stepanov 9dcd5a353a [msan] Intercept several malloc-related functions.
llvm-svn: 204923
2014-03-27 13:29:29 +00:00
Kostya Serebryany d093b5ac43 [asan] add a test case for r204897.
llvm-svn: 204903
2014-03-27 08:51:32 +00:00
Kostya Serebryany 88d0eac412 [asan] Do not sanitize kernel area on 32-bit targets, patch by Yuri Gribov
llvm-svn: 204897
2014-03-27 07:36:26 +00:00
Peter Collingbourne 5d167dae7d Add function to get the number of DFSan labels allocated.
Expose the number of DFSan labels allocated by adding function dfsan_get_label_count().

Patch by Sam Kerner!

Differential Revision: http://llvm-reviews.chandlerc.com/D3109

llvm-svn: 204854
2014-03-26 21:09:53 +00:00
Dmitry Vyukov e31dd3473e tsan: deflake test
llvm-svn: 204824
2014-03-26 15:51:11 +00:00
Dmitry Vyukov 4bfb4cb1e7 tsan: add pthread_barrier_t test
llvm-svn: 204810
2014-03-26 14:13:49 +00:00
Evgeniy Stepanov 16d89fc356 [sanitizer] Intercept __aeabi_mem(set|cpy|move).
llvm-svn: 204800
2014-03-26 12:14:34 +00:00
Dmitry Vyukov 775b11cc53 tsan: reduce default number of threads in benchmarks
buildbots seem to OOM with that many threads

llvm-svn: 204610
2014-03-24 15:23:05 +00:00
Dmitry Vyukov 238bd23534 tsan: add benchmarks for synchronization handling
llvm-svn: 204608
2014-03-24 14:32:59 +00:00
Kostya Serebryany 3df5d87da4 [sanitizer] print threads in deadlock report
llvm-svn: 204461
2014-03-21 13:00:18 +00:00
Kostya Serebryany 7317d9499b [sanitizer] more human-readable deadlock reports
llvm-svn: 204454
2014-03-21 11:37:43 +00:00
Sergey Matveev fa76f3b3a5 [MSan] Add __msan_unpoison_string() to the public interface.
Using __msan_unpoison() on null-terminated strings is awkward because
strlen() can't be called on a poisoned string. This case warrants a special
interface function.

llvm-svn: 204448
2014-03-21 10:12:17 +00:00
Evgeniy Stepanov d17b061eed [msan] Use new -fsanitize-memory-track-origins= flag in MSan tests.
llvm-svn: 204347
2014-03-20 15:00:39 +00:00
Dmitry Vyukov 454abc0093 tsan: deflake test
llvm-svn: 204340
2014-03-20 13:27:11 +00:00
Alexey Samsonov 6c3f7fcb8a Mark this test as 64-bit specific
llvm-svn: 204319
2014-03-20 07:37:45 +00:00
Dmitry Vyukov 1af191e1f4 tsan: add test for second_deadlock_stack flag
llvm-svn: 204240
2014-03-19 15:00:38 +00:00
Evgeniy Stepanov a57750482f [msan] Fix line numbers in test.
This corresponds to a fix in llvm::SplitBlockAndInsertIfThen.

llvm-svn: 204229
2014-03-19 12:56:38 +00:00
Kostya Serebryany 2ea796e05f [sanitizer] deadlock detector: a) initial support for suppressions, b) be more robust in case we failed to extract a stack trace for one of the locks
llvm-svn: 204225
2014-03-19 12:26:33 +00:00
Joerg Sonnenberger 14743127b7 Use CRT_HAS_128BIT.
llvm-svn: 204182
2014-03-18 21:35:30 +00:00
Evgeniy Stepanov 412d973980 [msan] Origin tracking with history, compiler-rt part.
Compiler-rt part of MSan implementation of advanced origin tracking,
when we record not only creation point, but all locations where
an uninitialized value was stored to memory, too.

llvm-svn: 204152
2014-03-18 13:45:19 +00:00
Dmitry Vyukov eac8cc7a42 tsan: fix flaky test
llvm-svn: 204119
2014-03-18 06:37:31 +00:00
Kostya Serebryany 5c0171b811 [sanitizer] a bit more informative deadlock detector report (still lots to improve)
llvm-svn: 204115
2014-03-18 05:56:14 +00:00
Kostya Serebryany f01c094cdd [sanitizer] reverse the order of the stack traces printed for every pair of locks in the deadlock report (first print the 'from' node, then print the 'to' node of the deadlock graph)
llvm-svn: 204043
2014-03-17 14:56:04 +00:00
Kostya Serebryany 8976539627 [sanitizer] make the deadlock detector print 2*N stack traces on lock-order-inversion with N locks (i.e. print stack traces for both lock acquisitions in every edge in the graph). More improvements to follow
llvm-svn: 204042
2014-03-17 14:41:36 +00:00
Kostya Serebryany 779ccf3b2c [sanitizer] one more output test for the deadlock detector
llvm-svn: 204036
2014-03-17 09:32:48 +00:00
Kostya Serebryany b9cb473fb8 [sanitizer] fix build warnings; add an output test for the deadlock detecor
llvm-svn: 204035
2014-03-17 09:21:41 +00:00
Alexander Potapenko b76ea32834 [ASan] Fix https://code.google.com/p/address-sanitizer/issues/detail?id=274
by ignoring globals from __TEXT,__cstring,cstring_literals during instrumenation.
Add a regression test.

llvm-svn: 203916
2014-03-14 10:41:49 +00:00
Dmitry Vyukov a02fac7bec tsan: update the test since the bug is fixed
http://llvm.org/bugs/show_bug.cgi?id=19113 is fixed, so enable the better CHECK

llvm-svn: 203784
2014-03-13 10:54:16 +00:00
Kostya Serebryany de3f20cf4b [sanitizer] support recursive rwlocks in bitset-based deadlock detector
llvm-svn: 203779
2014-03-13 10:26:03 +00:00
Dmitry Vyukov 8c0f86e307 tsan: fix handling of pthread_cond_wait in presence of pthread_cancel
if the thread is cancelled in pthread_cond_wait, it locks the mutex before
processing pthread_cleanup stack
but tsan was missing that, thus reporting false double-lock/wrong-unlock errors
see the test for details

llvm-svn: 203648
2014-03-12 09:48:14 +00:00
Dmitry Vyukov 47fd6179b1 tsan: add disabled test for http://llvm.org/bugs/show_bug.cgi?id=19113
llvm-svn: 203646
2014-03-12 08:24:49 +00:00
Alexey Samsonov 8ad7a05bb4 Improve llvm-symbolizer discovery in asan_symbolize.py
llvm-svn: 202982
2014-03-05 15:00:36 +00:00
Sergey Matveev 8bf42919e6 [msan] Make up for missing interceptor in getxattr() test.
llvm-svn: 202846
2014-03-04 13:13:34 +00:00
Alexey Samsonov 3d9adc0a73 [ASan] Speed up stack trace unwinding for stacks of size 2.
Summary:
We don't need to do any work in this case - just take
the current PC and caller PC.

Reviewers: eugenis, ygribov

Reviewed By: eugenis

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2936

llvm-svn: 202845
2014-03-04 13:12:25 +00:00
Sergey Matveev e7b3e4c2ae [msan] Add missing line to getxattr() test.
llvm-svn: 202841
2014-03-04 12:41:18 +00:00
Dmitry Vyukov 811d16c953 tsan: prevent actual deadlock in deadlock detector test
llvm-svn: 202502
2014-02-28 14:34:25 +00:00
Kostya Serebryany eae464f911 [sanitizer] speedup deadlock detector for the case when we acquire the first lock in a thread
llvm-svn: 202492
2014-02-28 11:56:14 +00:00
Kostya Serebryany afc4f2af76 [sanitizer] speedup deadlock detector for the case when we destroy a mutex that has never been locked
llvm-svn: 202487
2014-02-28 10:59:33 +00:00
Dmitry Vyukov 371639ea1f tsan: deflake test
llvm-svn: 202484
2014-02-28 10:47:07 +00:00
Kostya Serebryany 261993ad1a [sanitizer] a test for recursive rwlock and deadlock detector (currently fails)
llvm-svn: 202480
2014-02-28 10:03:51 +00:00
Kostya Serebryany b86b56c0db [tsan] one more test for deadlock detector
llvm-svn: 202476
2014-02-28 09:17:16 +00:00
Dmitry Vyukov d8c2fbd57f tsan: another attempt to fix the tls_get_addr crash
llvm-svn: 202405
2014-02-27 15:07:45 +00:00
Dmitry Vyukov a12923e265 tsan: intercept vfork
this fixes obscure false positives
see the comments and the test for details

llvm-svn: 202400
2014-02-27 14:36:16 +00:00
Dmitry Vyukov 17ca4d06c7 tsan: 2 more deadlock detector benchmarks
llvm-svn: 202379
2014-02-27 12:05:17 +00:00
Dmitry Vyukov 8a0813d944 tsan: fix deadlock detector lit test output
llvm-svn: 202368
2014-02-27 09:18:08 +00:00
Dmitry Vyukov 511118c762 tsan: add another deadlock detector benchmark
llvm-svn: 202366
2014-02-27 09:05:07 +00:00
Dmitry Vyukov 794500ae4e tsan: add recursive deadlock detector benchmark
llvm-svn: 202361
2014-02-27 08:33:52 +00:00
Dmitry Vyukov c546943b6a tsan: improve deadlock detector test
- allow to specify which test to run
- allow to specify number of iterations
- specify number of threads required in the test itself

llvm-svn: 202358
2014-02-27 08:04:20 +00:00
Dmitry Vyukov 0f34a3ba8c tsan: fix deadlock detector test so that it does not force contention in runtime
llvm-svn: 202278
2014-02-26 17:06:58 +00:00
Alexander Potapenko 4b1a7fe33a [ASan] Split interception-in-shared-lib-test.cc into two tests with platform-specific RUN commands.
Get rid of a TestCases/SharedLibs/shared-lib-test-so.cc dependency in these tests.

llvm-svn: 202267
2014-02-26 14:05:57 +00:00
Evgeniy Stepanov 6697dc6aa3 [asan] Remove extra sonames from libraries in tests.
llvm-svn: 202156
2014-02-25 15:25:37 +00:00
Kostya Serebryany 67968cbf93 [sanitizer] minimal support for recursive locks indeadlock detector
llvm-svn: 202153
2014-02-25 14:02:01 +00:00
Evgeniy Stepanov e4d8577c69 [asan] Reenable waitid test on Android.
waitid() is present since API level 9 (Android 2.3). That's old enough.

llvm-svn: 202149
2014-02-25 13:24:42 +00:00
Alexey Samsonov 98aa08c0e9 Update sanitizers' bash scripts.
* Fix bash scripts to work on FreeBSD (patch by Viktor Kutuzov)
* Update locations of lit tests in check_lint script.

llvm-svn: 202145
2014-02-25 12:09:25 +00:00
Kostya Serebryany 01be296dbb [sanitizer] support pthread_rwlock_rd* in deadlock detector
llvm-svn: 202132
2014-02-25 10:33:37 +00:00
Kostya Serebryany fd88edfddb [sanitizer] partially support pthread_rwlock_* (no rd* form yet)
llvm-svn: 202128
2014-02-25 09:33:10 +00:00
Kostya Serebryany 8f240ec03f [tsan] add deadlock detector tests for pthread_spin_lock
llvm-svn: 202123
2014-02-25 08:42:34 +00:00
Kostya Serebryany 11f4f30fa7 [sanitizer] add support for try_lock in deadlock detector
llvm-svn: 202120
2014-02-25 08:24:15 +00:00
Evgeniy Stepanov 4bf7a268e0 [asan] Add a test for interceptors in shared libraries.
llvm-svn: 202037
2014-02-24 14:31:28 +00:00
Kostya Serebryany d77dfcb384 [tsan] one more test for deadlock detector
llvm-svn: 202026
2014-02-24 11:45:47 +00:00
Evgeniy Stepanov c0ae3dfc3a [asan] A test was reverted, but not "svn rm"-ed in r202016.
llvm-svn: 202025
2014-02-24 11:43:47 +00:00
Evgeniy Stepanov 4c32d16c76 Revert r202014.
Failing on the bots for an unknown reason.

llvm-svn: 202016
2014-02-24 10:21:44 +00:00
Evgeniy Stepanov 567e0eef4c [asan] Add a test for interceptors in shared libraries.
llvm-svn: 202014
2014-02-24 10:04:42 +00:00
Evgeniy Stepanov d512234d7e [asan] Avoid hardcoding library path in test binary.
llvm-svn: 202013
2014-02-24 10:03:33 +00:00
Kostya Serebryany 0548c79859 [tsan] add coarse-grained lock around the DeadlockDetector. We can do better than that, but that's a start.
llvm-svn: 201861
2014-02-21 15:07:18 +00:00
Alexey Samsonov 04e7ad29ea [CMake] Introduce check-all command for standalone compiler-rt build
llvm-svn: 201780
2014-02-20 12:36:26 +00:00
Alexey Samsonov 35a66d15d4 Move config for sanitizer_common tests under test/ for consistency
llvm-svn: 201779
2014-02-20 12:18:08 +00:00
Alexey Samsonov 5e6d83258e [CMake] lit tests shouldn't depend on runtimes in standalone build
llvm-svn: 201771
2014-02-20 09:47:18 +00:00
Alexey Samsonov 31043152d3 Add rudimentary support for running compiler-rt lit tests with GCC
llvm-svn: 201680
2014-02-19 15:13:14 +00:00
Kostya Serebryany 699b975014 [tsan] improve the test that checks for lock inversion with 3 locks
llvm-svn: 201676
2014-02-19 14:24:31 +00:00
Kostya Serebryany b51f8d4990 [tsan] when printing a mutex, also print its address. Properly print the deadlock report.
llvm-svn: 201675
2014-02-19 14:17:25 +00:00
Alexey Samsonov 8067448dfe [CMake] Use host compiler to run lit tests in standalone mode
llvm-svn: 201674
2014-02-19 13:45:49 +00:00
Evgeniy Stepanov cc8e58bc46 [asan] Ensure that stack is limited before attempting to overflow it.
Very bad things happen otherwise.

llvm-svn: 201670
2014-02-19 12:43:27 +00:00
Alexey Samsonov cd8535a96d [CMake] Introduce COMPILER_RT_INCLUDE_TESTS option
llvm-svn: 201666
2014-02-19 11:18:47 +00:00
Evgeniy Stepanov 2274ba7716 [asan] Improve stack overflow detection.
There are more cases when those manifest as an access below SP.

llvm-svn: 201664
2014-02-19 11:02:46 +00:00
Alexey Samsonov aa980c760b [CMake] Add the way to run tests in standalone build.
1) Depend on llvm-config (configured in LLVM_CONFIG_PATH) to
get necessary LLVM source/binary directories.
2) Add basic support for running lit tests (check-xsan commands).
For now this "support" is far from what we want:
  * unit tests are not built currently.
  * lit tests use Clang/compiler-rt from LLVM build directory,
    not the host compiler or just-built compiler-rt libraries.

We should make a choice on the way we intend ti run compiler-rt lit testsuite:
a) use either Clang from LLVM build tree, or the host compiler.
b) use either just-built runtimes, or the runtimes shipped with the
host compiler.

Using just-built runtimes is tricky - we have to know where to put them, so that
Clang/GCC driver would pick them up (and not overwrite the existing runtimes).
Using a host compiler instead of Clang from LLVM build tree will give us a chance to
run lit tests under GCC (which already has support for several sanitizers).

That is, I tend to make the following choice: if we're in a standalone compiler-rt
build, use host compiler with its set of runtime libraries to run lit tests.
This will effectively decouple "make compiler-rt" and "make check-compiler-rt" in
a standalone build - the latter wouldn't invoke the former. Note that if we decide
to fix LLVM/Clang/compiler-rt build system so that it would configure/build
compiler-rt with just-built Clang (as we do in Makefile-based build), this will not
be a problem - we can add a dependency to ensure that clang/compiler-rt are rebuilt
before running compiler-rt tests.

llvm-svn: 201656
2014-02-19 10:04:29 +00:00
Kostya Serebryany 37ce26cb16 [sanitizer] when reporting a deadlock also report the lock cycle
llvm-svn: 201576
2014-02-18 14:56:19 +00:00
Kostya Serebryany bd86a29a2a [sanitizer] make sure the deadlock detector survives the change of epochs; add a test and a comment
llvm-svn: 201572
2014-02-18 13:41:49 +00:00
Evgeniy Stepanov b036778bdb [asan] Relax stack-overflow test.
llvm-svn: 201571
2014-02-18 13:11:40 +00:00
Kostya Serebryany aa416c39cd [tsan] in deadlock detector do not register locks on their creation and unregister them on destruction; added a relevant test
llvm-svn: 201568
2014-02-18 12:50:31 +00:00
Evgeniy Stepanov a50abe6656 [asan] Disable stack-overflow test on main thread.
Failing on some bots.

llvm-svn: 201567
2014-02-18 12:29:39 +00:00
Evgeniy Stepanov 65b959afad [asan] Stack overflow detection.
Report segmentation faults near or below stack bottom as stack-overflow
(not stack-buffer-overflow!).

llvm-svn: 201565
2014-02-18 11:49:52 +00:00
Evgeniy Stepanov 1b16a9d3b0 [asan] Fix one test on OSX.
llvm-svn: 201564
2014-02-18 11:32:24 +00:00
Kostya Serebryany 67bf8bd124 [tsan] one more lit test for deadlock detector; more to come
llvm-svn: 201554
2014-02-18 09:08:03 +00:00
Alexey Samsonov 2769570556 Simplify lit test configs for LSan and UBSan by using a generic config
llvm-svn: 201553
2014-02-18 08:56:49 +00:00
Alexey Samsonov eb6ef12203 Drop test/asan/GenericConfig directory
llvm-svn: 201552
2014-02-18 08:24:28 +00:00
Evgeniy Stepanov 77d9ae6c0f [asan] Replace rand_r with rand in test.
llvm-svn: 201548
2014-02-18 08:03:44 +00:00
Alexey Samsonov b73db72a17 [CMake] Simplify setting compile flag disabling RTTI
llvm-svn: 201547
2014-02-18 07:52:40 +00:00
Alexey Samsonov 4dcbe7e959 Remove debug print
llvm-svn: 201544
2014-02-18 07:30:37 +00:00
Alexey Samsonov 1c9b9bcb5c Simplify defining Clang compile flags in lit configs
llvm-svn: 201513
2014-02-17 13:08:10 +00:00
Evgeniy Stepanov 9e629abf1e [asan] Add a test for stack unwinding in new and delete.
llvm-svn: 201511
2014-02-17 11:52:29 +00:00
Evgeniy Stepanov 6c34935292 [asan] Replace posix_memalign with memalign in test.
Android does not provide posix_memalign.

llvm-svn: 201420
2014-02-14 15:02:36 +00:00
Alexey Samsonov 9a70077b47 [ASan] Rename asan_runtime_libraries to asan. Re-enable tests on Android.
llvm-svn: 201417
2014-02-14 14:45:13 +00:00
Evgeniy Stepanov cbb2d5eee4 [asan] Disabled one more test on Android.
llvm-svn: 201416
2014-02-14 14:37:13 +00:00
Evgeniy Stepanov 44f5d8a49f [asan] Change stack uar test to not use ulimit.
Because of how Android test runner is implemented, ulimit in RUN: line
gets executed on the host machine and does not affect the test.

llvm-svn: 201415
2014-02-14 14:36:42 +00:00
Alexey Samsonov e6a6183e9b Move TSan lit-tests under test/tsan
llvm-svn: 201414
2014-02-14 14:35:48 +00:00
Alexey Samsonov 9f20d67034 Move ASan lit-tests under test/asan
llvm-svn: 201413
2014-02-14 14:06:10 +00:00
Alexey Samsonov 8434e60f7e Move MSan lit-tests under test/msan
llvm-svn: 201412
2014-02-14 13:02:58 +00:00
Alexey Samsonov 7eeef85bd4 Move LSan test suite under test/
llvm-svn: 201408
2014-02-14 12:26:05 +00:00
Alexey Samsonov f6cf6ab53b Move DFSan test suite under test/
llvm-svn: 201403
2014-02-14 12:05:41 +00:00
Alexey Samsonov ba869e79a0 Move UBSan test suite under test/
llvm-svn: 201401
2014-02-14 11:42:22 +00:00
Alexey Samsonov 81a2b466e9 Move shared configs for lit test suites to test/ and unittests/ directories
llvm-svn: 201399
2014-02-14 11:00:07 +00:00
Alexey Samsonov 8c1441f860 Move tests for BlocksRuntime and builtins to corresponding directories under test/
llvm-svn: 201396
2014-02-14 09:47:31 +00:00
Nick Kledzik 23bbd617e4 <rdar://problem/12512722> Use arm divide instruction if available
llvm-svn: 182665
2013-05-24 19:38:11 +00:00
Eric Christopher 8539af7bbb Both OpenBSD and Bitrig need to include machine/endian.h to get the
_BYTE_ORDER define.

Patch by David Hill.

llvm-svn: 164286
2012-09-20 06:19:20 +00:00
Chandler Carruth 6acfaaf3aa Remove the old, and non-functional CMake build system from CompilerRT.
I cannot build any part of this successfully on either Linux or Darwin,
and the replacement is worlds simpler by requiring that this be built as
a subproject of LLVM. If this breaks you for any reason, please let me
know, and let me know what your use case is.

llvm-svn: 154059
2012-04-04 22:12:01 +00:00
Anton Korobeynikov 48cfd55c5d Add some basic mingw support.
Patch by Ruben Van Boxem! 

llvm-svn: 148048
2012-01-12 21:13:48 +00:00
Rafael Espindola a0fbaeebe6 Fix build on minix. Patch by Ben Gras!
llvm-svn: 147632
2012-01-05 23:59:42 +00:00
Eric Christopher 1d1809437e Implement mulo<mode>4 for use in signed overflow checking.
Fixes rdar://9219742 and rdar://9218244

llvm-svn: 133284
2011-06-17 20:17:05 +00:00
Joerg Sonnenberger d9bcddd6b9 If a test case is not compiled on a specific platform, print "skipped"
to stdout. This helps identifying missing coverage on a given platform.

llvm-svn: 132300
2011-05-29 21:43:29 +00:00
Nick Kledzik 47a823b281 <rdar://problem/8914924> implement udivmodsi4 and divmodsi4 for ARM
llvm-svn: 127778
2011-03-17 00:09:13 +00:00
Howard Hinnant 5b791f6e64 license change
llvm-svn: 119397
2010-11-16 22:13:33 +00:00
Stephen Canon 75a21dc9a7 Tests for soft-float comparison functions
llvm-svn: 107414
2010-07-01 18:35:50 +00:00
Daniel Dunbar efd84e770b Add support for "platform" configurations, which define a suite of compiler-rt
libraries to generate.
 - Each library may be built with different flags and for different
   architectures, and there is support for building Darwin style fat archives.

 - Uses an ambituous amount of make programming, but should be hidden to
   users and developers.

llvm-svn: 93720
2010-01-18 06:49:33 +00:00
Daniel Dunbar 32f75c6a42 Unbreak trampoline test.
llvm-svn: 93711
2010-01-18 06:48:06 +00:00
Edward O'Callaghan 07d6005bdc Nested function test in compiler-rt should not be run under Clang.
llvm-svn: 85456
2009-10-29 00:27:08 +00:00
Edward O'Callaghan 7c1cc70a90 Fix test suit for last CMake changes to CompilerRT.
llvm-svn: 85452
2009-10-29 00:16:23 +00:00
Shantonu Sen 04f121bc50 Work around strictness in gcc 4.4.1 casting a function pointer to void *
llvm-svn: 85397
2009-10-28 15:54:04 +00:00
Shantonu Sen 1467592c6d Add stdlib.h for rand() prototype
llvm-svn: 85396
2009-10-28 15:46:10 +00:00
Edward O'Callaghan 6d0a86cbd1 Update web docs for cmake test suit, comment out broken test.
llvm-svn: 85350
2009-10-28 00:09:30 +00:00
Edward O'Callaghan 1bafa6de57 Fix cmake test suit for compiler-rt.
llvm-svn: 85339
2009-10-27 23:23:41 +00:00
Daniel Dunbar 64857209fb Fix tests broken by removal of de-anonyomizing structs.
llvm-svn: 85261
2009-10-27 17:49:07 +00:00
Daniel Dunbar 247687360f Remove duplicate copy of int_lib.h, and update test script to find copy inside lib/.
Also, fix some brokenness in the test script w.r.t REMOTE.

llvm-svn: 85260
2009-10-27 17:48:46 +00:00
Edward O'Callaghan c0c9968f1b Comment out broken tests and make the rest build in cmake build system.
llvm-svn: 84330
2009-10-17 10:19:32 +00:00
Nick Kledzik ad160c0330 add conversion functions and test cases for ARM
llvm-svn: 81809
2009-09-14 23:26:56 +00:00
Edward O'Callaghan 882b798a50 Generalize Blocks code and intergrate with cmake build system more.
llvm-svn: 81613
2009-09-12 15:47:39 +00:00
Nick Kledzik 9130011d5f add comparison functions for ARM
llvm-svn: 81597
2009-09-12 01:23:48 +00:00
Nick Kledzik a6bce00934 rename files
llvm-svn: 81572
2009-09-11 21:16:10 +00:00
Nick Kledzik 3d22a3af2d add _test in file names
llvm-svn: 81561
2009-09-11 20:13:32 +00:00
Nick Kledzik b9c6e4a189 start adding implementation of arm *vfp routines with test cases
llvm-svn: 81558
2009-09-11 20:02:01 +00:00
Nick Kledzik 7e71865ca5 use HAS_80_BIT_LONG_DOUBLE so some tests work properly on arm
llvm-svn: 81552
2009-09-11 19:09:36 +00:00
Daniel Dunbar 3c8a7dfada Use -lc -lm to link with (in tests) on non-Darwin.
llvm-svn: 80939
2009-09-03 20:09:38 +00:00
Daniel Dunbar f9812f75d0 Don't use -arch on non-Darwin.
llvm-svn: 80938
2009-09-03 20:03:21 +00:00
Daniel Dunbar da208e779b Convert tabs to spaces.
llvm-svn: 80937
2009-09-03 20:03:14 +00:00
Edward O'Callaghan 19db729ab4 Add support for ellcc, Credit to Richard Pennington.
llvm-svn: 79332
2009-08-18 11:54:44 +00:00
Edward O'Callaghan 514553d84a Fix testsuit build on linux.
llvm-svn: 79331
2009-08-18 11:50:23 +00:00
Edward O'Callaghan ea0bd0d0a4 Fix pre-processor mistake for BSDs in endianness.h
llvm-svn: 79330
2009-08-18 11:07:59 +00:00
Edward O'Callaghan ccf48131d0 Refactor to remove un-named struct gnu extension usage. Now ISO C89 and C99 compliant. Comment trailing endifs
llvm-svn: 78537
2009-08-09 18:41:02 +00:00
Edward O'Callaghan 032ab6f978 Fix signedness warning in mprotect call, Clean up and improve endianness.h header.
llvm-svn: 78451
2009-08-08 02:31:50 +00:00
Edward O'Callaghan e556e8eb9f Forgot to add new endianness.h header file.
llvm-svn: 78235
2009-08-05 19:58:45 +00:00
Edward O'Callaghan 7a6cb5febf Refactor test suit endianness pre-processor code. More style and readability fixes, start labling endif's
llvm-svn: 78234
2009-08-05 19:57:20 +00:00
Edward O'Callaghan df72046277 Start porting compiler-rt testsuit to Solaris with new build system. Fix some C++ style comments which are not allowed in ISO C90.
llvm-svn: 78143
2009-08-05 01:47:29 +00:00
Edward O'Callaghan 6912ed0f36 Initial import of CMake type build system. Just like the rest of llvm..
llvm-svn: 77933
2009-08-03 01:08:25 +00:00
Daniel Dunbar fd089990f7 Initial import of compiler-rt.
-

llvm-svn: 74292
2009-06-26 16:47:03 +00:00