Skip to content

Commit

Permalink
[ubsan] Make suppressions.cpp test pass for me on Windows
Browse files Browse the repository at this point in the history
The test seems to be failing because the module suppression file
contains a colon. I found that it was sufficient to just use the
basename of the suppression file.

While I was here, I noticed that we don't implement IsAbsolutePath for
Windows, so I added it.

llvm-svn: 352921
  • Loading branch information
rnk committed Feb 1, 2019
1 parent afc24ed commit 33706e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion compiler-rt/lib/sanitizer_common/sanitizer_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,14 @@ bool IsPathSeparator(const char c) {
return c == '\\' || c == '/';
}

static bool IsAlpha(char c) {
c = ToLower(c);
return c >= 'a' && c <= 'z';
}

bool IsAbsolutePath(const char *path) {
UNIMPLEMENTED();
return path != nullptr && IsAlpha(path[0]) && path[1] == ':' &&
IsPathSeparator(path[2]);
}

void SleepForSeconds(int seconds) {
Expand Down
5 changes: 4 additions & 1 deletion compiler-rt/test/ubsan/TestCases/Integer/suppressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@

// RUN: echo "unsigned-integer-overflow:do_overflow" > %t.func-supp
// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.func-supp"' %run %t
// RUN: echo "unsigned-integer-overflow:%t" > %t.module-supp
// FIXME: The '%t' substitution can't be used for the module name because it
// contains a colon, so we have to use the basename, which is
// suppressions.cpp.tmp.
// RUN: echo "unsigned-integer-overflow:suppressions.cpp.tmp" > %t.module-supp
// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.module-supp"' %run %t

// Note: file-level suppressions should work even without debug info.
Expand Down

0 comments on commit 33706e3

Please sign in to comment.