llvm-project/compiler-rt/test/ubsan/TestCases/Misc
Dan Liew fb310c0af9 [UBSan] Partially fix `test/ubsan/TestCases/Misc/log-path_test.cc` so that it can run on devices.
Summary:
In order for this test to work the log file needs to be removed from both
from the host and device. To fix this the `rm` `RUN` lines have been
replaced with `RUN: rm` followed by `RUN: %device_rm`.

Initially I tried having it so that `RUN: %run rm` implicitly runs `rm`
on the host as well so that only one `RUN` line is needed. This
simplified writing the test however that had two large drawbacks.

* It's potentially very confusing (e.g. for use of the device scripts outside
  of the lit tests) if asking for `rm` to run on device also causes files
  on the host to be deleted.

* This doesn't work well with the glob patterns used in the test.
  The host shell expands the `%t.log.*` glob pattern and not on the
  device so we could easily miss deleting old log files from previous
  test runs if the corresponding file doesn't exist on the host.

So instead deletion of files on the device and host are explicitly
separate commands.

The command to delete files from a device is provided by a new
substitution `%device_rm` as suggested by Filipe Cabecinhas.

The semantics of `%device_rm` are that:

* It provides a way remove files from a target device when
 the host is not the same as the target. In the case that the
 host and target are the same it is a no-op.

* It interprets shell glob patterns in the context of the device
  file system instead of the host file system.
  This solves the globbing problem provided the argument is quoted so
  that lit's underlying shell doesn't try to expand the glob pattern.

* It supports the `-r` and `-f` flags of the `rm` command,
  with the same semantics.

Right now an implementation of `%device_rm` is provided only for
ios devices. For all other devices a lit warning is emitted and
the `%device_rm` is treated as a no-op. This done to avoid changing
the behaviour for other device types but leaves room for others
to implement `%device_rm`.

The ios device implementation uses the `%run` wrapper to do the work
of removing files on a device.

The `iossim_run.py` script has been fixed so that it just runs `rm`
on the host operating system because the device and host file system
are the same.

rdar://problem/41126835

Reviewers: vsk, kubamracek, george.karpenkov, eugenis

Subscribers: #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D51648

llvm-svn: 342391
2018-09-17 13:33:44 +00:00
..
Inputs [ubsan] Diagnose noreturn functions which return (compiler-rt) 2017-12-21 00:10:36 +00:00
Linux [ubsan]: temporarily disable print_stack_trace.cc test 2017-05-05 14:51:16 +00:00
bool.cpp
bool.m [ubsan] Fix error summary message for ObjC BOOL invalid loads 2017-05-05 01:35:42 +00:00
bounds.cpp [ubsan] Test for pass_object_size bounds checks 2017-12-08 01:51:51 +00:00
builtins.cpp [ubsan] Diagnose invalid uses of builtins (compiler-rt) 2017-07-29 00:20:02 +00:00
coverage-levels.cc [compiler-rt] Get rid of "%T" expansions 2018-07-10 12:53:46 +00:00
deduplication.cpp
enum.cpp [CMake] Use normalized Windows target triples 2018-08-09 02:16:18 +00:00
log-path_test.cc [UBSan] Partially fix `test/ubsan/TestCases/Misc/log-path_test.cc` so that it can run on devices. 2018-09-17 13:33:44 +00:00
missing_return.cpp [UBsan] Enable subset of unit tests for OpenBSD 2018-06-30 21:35:05 +00:00
monitor.cpp [CMake] Use normalized Windows target triples 2018-08-09 02:16:18 +00:00
no-interception.cpp sanitizer_common: Try looking up symbols with RTLD_DEFAULT if RTLD_NEXT does not work. 2017-11-10 22:09:37 +00:00
nonnull-arg.cpp
nonnull.cpp [ubsan] Improve diagnostics for return value checks (compiler-rt) 2017-06-23 21:32:48 +00:00
nullability.c [ubsan] Improve diagnostics for return value checks (compiler-rt) 2017-06-23 21:32:48 +00:00
unreachable.cpp [ubsan] Diagnose noreturn functions which return (compiler-rt) 2017-12-21 00:10:36 +00:00
vla.c [test] Use @LINE macro 2017-02-23 17:23:28 +00:00