Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build options for running tests under thread sanitizer #1930

Closed
brson opened this issue Mar 6, 2012 · 10 comments
Closed

Add build options for running tests under thread sanitizer #1930

brson opened this issue Mar 6, 2012 · 10 comments
Labels
A-concurrency Area: Concurrency A-sanitizers Area: Sanitizers for correctness and code quality A-testsuite Area: The testsuite used to check the correctness of rustc C-feature-request Category: A feature request, i.e: not implemented / a PR. P-low Low priority

Comments

@brson
Copy link
Contributor

brson commented Mar 6, 2012

We can now run tests under helgrind. For bonus fun we should be able to run under thread sanitizer (a google-backed valgrind plugin) which does similar-but-different things.

@ghost ghost assigned brson Mar 8, 2012
@catamorphism
Copy link
Contributor

assigning to @brson since he seems to do Most Things Testsuite.

@bstrie
Copy link
Contributor

bstrie commented Jun 24, 2013

I presume that we're going to require the user to have installed tsan themselves, and therefore this just needs to be a configuration flag like --enable-tsan that then passes the correct flags to the test runner.

tsan home page: https://code.google.com/p/data-race-test/wiki/ThreadSanitizer

@thestinger
Copy link
Contributor

This has yet to be implemented.

@catamorphism
Copy link
Contributor

Low, no milestone

@alexcrichton
Copy link
Member

A recent article claims that they're on v2 at this point and that it does not have much overhead at all.

Additionally, it sounds like the meaty stuff is implemented in LLVM, we likely just need to have some instrumentation here and there. The part that interests me the most is:

ThreadSanitizer v2 recognizes atomic operations, so it produces far more accurate reports and can also find bugs in lock-free algorithms, which are hard to detect otherwise

That would be amazing to detect, especially for the runtime!

@steveklabnik
Copy link
Member

Is this still something we wish to do?

@apasel422
Copy link
Contributor

What's the status of this? I'd like to use it for testing the Arc implementation.

@apasel422
Copy link
Contributor

It's currently possible to specify rustc -C passes=tsan, but the appropriate library isn't linked in:

error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "foo.0.o" "-o" "foo" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/andrew/.rust/lib/x86_64-unknown-linux-gnu" "-L" "/home/andrew/lib/x86_64-unknown-linux-gnu" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8cf6ce90.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-8cf6ce90.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_unicode-8cf6ce90.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-8cf6ce90.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-8cf6ce90.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-8cf6ce90.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-8cf6ce90.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-8cf6ce90.rlib" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "rt" "-l" "pthread" "-l" "c" "-l" "m" "-l" "compiler-rt"
note: foo.0.o: In function `main':
foo.0.rs:(.text.main+0x17): undefined reference to `__tsan_func_entry'
foo.0.rs:(.text.main+0x39): undefined reference to `__tsan_func_exit'
foo.0.o: In function `tsan.module_ctor':
foo.0.rs:(.text.tsan.module_ctor+0x2): undefined reference to `__tsan_init'
collect2: error: ld returned 1 exit status

error: aborting due to previous error

@pmarcelll
Copy link
Contributor

Related to #39699.

@Mark-Simulacrum Mark-Simulacrum added the A-sanitizers Area: Sanitizers for correctness and code quality label Jun 23, 2017
@Mark-Simulacrum Mark-Simulacrum added C-feature-request Category: A feature request, i.e: not implemented / a PR. and removed C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Jul 19, 2017
@steveklabnik
Copy link
Member

Triage: #39699 is a duplicate and has more up-to-date info.

RIP one of rustc's last four digit issues. <3

celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-concurrency Area: Concurrency A-sanitizers Area: Sanitizers for correctness and code quality A-testsuite Area: The testsuite used to check the correctness of rustc C-feature-request Category: A feature request, i.e: not implemented / a PR. P-low Low priority
Projects
None yet
Development

No branches or pull requests

9 participants