1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[llvm-ar] Add more tests for errors in opening archives

Add 2 more tests for the function performOperation under llvm-ar.cpp. It
tests the scenario when the archive could not be opened for reasons
other than `no_such_file_or_directory` In particular, it tests for the
cases `permission_denied` and `is_a_directory` for the target archive.

Reviewed By: alexshap, jhenderson, smeenai, MaskRay

Differential Revision: https://reviews.llvm.org/D80838
This commit is contained in:
Sameer Arora 2020-06-05 10:29:18 -07:00 committed by Shoaib Meenai
parent 452b7f14a9
commit c8c3d7d667
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,8 @@
# RUN: rm -rf %t && mkdir -p %t
## Passing in a directory:
# RUN: mkdir -p %t/tmpDir
# RUN: not llvm-ar p %t/tmpDir 2>&1 | \
# RUN: FileCheck %s --check-prefix=IS-DIR -DARCHIVE=%t/tmpDir
# IS-DIR: error: error opening '[[ARCHIVE]]': {{[iI]}}s a directory

View File

@ -0,0 +1,14 @@
## Unsupported on windows as marking files "unreadable"
## is non-trivial on windows.
# UNSUPPORTED: system-windows
# RUN: rm -rf %t && mkdir -p %t
# RUN: echo file1 > %t/1.txt
## No Permission:
# RUN: llvm-ar rc %t/permission.b %t/1.txt
# RUN: chmod 100 %t/permission.b
# RUN: not llvm-ar p %t/permission.b 2>&1 | \
# RUN: FileCheck %s --check-prefix=NO-PERMISSION -DARCHIVE=%t/permission.b
# NO-PERMISSION: error: error opening '[[ARCHIVE]]': {{[pP]}}ermission denied