mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
Fix code coverage causing test failures
Summary: Sandcastle's [1] code coverage builds compile EdenFS and Hg with Clang's -fprofile-generate flag (or a related flag). By default, running a program with with that flag creates a `default.profraw` file in the current directory. This causes some tests to fail, such as HgBackingStoreTest.getTreeForCommit_reimports_tree_if_it_was_deleted_after_import, because `default.profraw` is unintentionally committed to the test repo: ``` [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from HgBackingStoreTest [ RUN ] HgBackingStoreTest.getTreeForCommit_reimports_tree_if_it_was_deleted_after_import eden/fs/store/hg/test/HgBackingStoreTest.cpp:64: Failure Value of: tree1->getEntryNames() Expected: has 2 elements where element #0 is equal to foo, element #1 is equal to src Actual: { default.profraw, foo, src }, which has 3 elements [ FAILED ] HgBackingStoreTest.getTreeForCommit_reimports_tree_if_it_was_deleted_after_import (1563 ms) [----------] 1 test from HgBackingStoreTest (1563 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (1563 ms total) [ PASSED ] 0 tests. [ FAILED ] 1 test, listed below: [ FAILED ] HgBackingStoreTest.getTreeForCommit_reimports_tree_if_it_was_deleted_after_import ``` When Sandcastle runs the tests, it sets the `LLVM_PROFILE_FILE` environment variable, which configures the path to `default.profraw`. EdenFS' HgRepo class is stripping this variable when invoking hg, so hg uses the default path and not the configured path. Make HgRepo pass `LLVM_PROFILE_FILE` through to hg. This fixes some of EdenFS' tests when run by Sandcastle for code coverage purposes. (This does *not* fix running the tests manually (without setting `LLVM_PROFILE_FILE`), though.) [1] Sandcastle is Facebook's continuous integration system. Reviewed By: simpkins Differential Revision: D15104832 fbshipit-source-id: 3929b9b0ab0904f2552ace7d8e4e4f4a4221192c
This commit is contained in:
parent
573075ac37
commit
84fccd7148
@ -63,7 +63,8 @@ HgRepo::HgRepo(AbsolutePathPiece path) : path_{path} {
|
||||
XLOG(DBG1) << "Using hg command: " << hgCmd_;
|
||||
|
||||
// Set up hgEnv_
|
||||
std::vector<const char*> passthroughVars{{"PATH", "HG_REAL_BIN"}};
|
||||
std::vector<const char*> passthroughVars{
|
||||
{"HG_REAL_BIN", "LLVM_PROFILE_FILE", "PATH"}};
|
||||
for (const char* varName : passthroughVars) {
|
||||
auto value = getenv(varName);
|
||||
if (value) {
|
||||
|
Loading…
Reference in New Issue
Block a user