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: %run 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 has two large drawbacks.
- It's potentially very confusing 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.
To solve the globbing problem, the glob pattern passed to %run rm is
quoted so that the handling script can passed the unexpanded glob
pattern to the device so it can be expanded there. All implementations
of %run need to handle rm specially so that globbing patterns are
expanded on the 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.
A visual inspection of android_run.py suggests that shell globbing
should work because it makes no attempt to quote paths when invoking
adb shell.
rdar://problem/41126835
@dliew actually, stepping back a bit here, why can't we just do
?
whatever shell expansions are there, they would be already expanded by the shell at that point.