diff options
author | Maksim Panchenko <maks@fb.com> | 2022-12-06 15:49:35 -0800 |
---|---|---|
committer | Maksim Panchenko <maks@fb.com> | 2022-12-07 17:11:30 -0800 |
commit | 0f915826cc86fc585f23d4f742a27ed9e8751f76 (patch) | |
tree | b59da99d72bae23677c9879845bf040261b1c7ee /bolt/test | |
parent | f6b1d88527886683a67bebf27df3ad626fa3940e (diff) | |
download | llvm-0f915826cc86fc585f23d4f742a27ed9e8751f76.tar.gz |
[BOLT] Handle access errors while reading profile
When the user does not have permissions to access the profile, consume
the error contained in Expected<> to avoid dumping stack to the user.
Differential Revision: https://reviews.llvm.org/D139480
Diffstat (limited to 'bolt/test')
-rw-r--r-- | bolt/test/unreadable-profile.test | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bolt/test/unreadable-profile.test b/bolt/test/unreadable-profile.test new file mode 100644 index 000000000000..fe1ca93f3221 --- /dev/null +++ b/bolt/test/unreadable-profile.test @@ -0,0 +1,13 @@ +REQUIRES: system-linux + +RUN: touch %t.profile && chmod 000 %t.profile +RUN: %clang %S/Inputs/hello.c -o %t +RUN: not llvm-bolt %t -o %t.bolt --data %t.profile 2>&1 \ +RUN: | FileCheck %s --check-prefix CHECK-NOPERM +RUN: not llvm-bolt %t -o %t.bolt --data %t.fake.profile 2>&1 \ +RUN: | FileCheck %s --check-prefix CHECK-FAKE + +## Check that llvm-bolt gracefully handles errors accessing profile data. + +CHECK-NOPERM: Permission denied +CHECK-FAKE: No such file or directory |