Skip to content

Add build options for running tests under thread sanitizer #1930

@brson

Description

@brson
Contributor

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.

Activity

ghost assigned on Mar 8, 2012
catamorphism

catamorphism commented on Mar 8, 2012

@catamorphism
Contributor

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

bstrie

bstrie commented on Jun 24, 2013

@bstrie
Contributor

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

thestinger commented on Sep 9, 2013

@thestinger
Contributor

This has yet to be implemented.

catamorphism

catamorphism commented on Oct 24, 2013

@catamorphism
Contributor

Low, no milestone

alexcrichton

alexcrichton commented on Apr 21, 2014

@alexcrichton
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

steveklabnik commented on Jan 20, 2015

@steveklabnik
Member

Is this still something we wish to do?

apasel422

apasel422 commented on Nov 1, 2015

@apasel422
Contributor

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

apasel422

apasel422 commented on Nov 1, 2015

@apasel422
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

pmarcelll commented on Mar 5, 2017

@pmarcelll
Contributor

Related to #39699.

added
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.
and removed
C-enhancementCategory: An issue proposing an enhancement or a PR with one.
on Jul 19, 2017
steveklabnik

steveklabnik commented on Sep 24, 2018

@steveklabnik
Member

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

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

4 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-concurrencyArea: ConcurrencyA-sanitizersArea: Sanitizers for correctness and code qualityA-testsuiteArea: The testsuite used to check the correctness of rustcC-feature-requestCategory: A feature request, i.e: not implemented / a PR.P-lowLow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @steveklabnik@alexcrichton@brson@catamorphism@bstrie

        Issue actions

          Add build options for running tests under thread sanitizer · Issue #1930 · rust-lang/rust