History log of /external/vogar/src/vogar/tasks/RunActionTask.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
411cb1fb67241125203629229600ecbd821eb9c7 19-Nov-2015 Paul Duffin <paulduffin@google.com> Fix escaping and grouping of arguments to the Target shells

Vogar allows custom arguments to be passed to the classes being
tested. If these contain special shell characters then the
command line used to run the tests may not be correct. e.g. If
the argument was "-Cvm.args=-Xmx256M -Xms256M" (which tells
Caliper to run the benchmark in a process with an initial and
maximum heap size of 256M) then when the command is actually run
by the adb shell they are split into two arguments,
"-Cvm.args=-Xmx256M" and "-Xms256M" which causes Caliper to fail
as the latter is an unrecognized Caliper option.

The solution is to simply escape any special shell characters
with a backslash (\) to ensure that they are treated as literal
characters.

Another bug is that any use of an argument "-c" will result in
all the following arguments being grouped into one, e.g.
fred -c wilma barney betty
will become
fred -c "wilma barney betty"

This behaviour is required when the -c option is part of "sh"
"-c" but not in any other case. This is currently implemented in
Command which is the wrong place as it's a generic class
independent of the Target and the grouping is dependent on the
target shell.

After some investigation it turns out that while grouping isn't
required for AdbTarget and SshTarget like it is for HostTarget
neither does it break anything. Therefore, for simplicity's sake
all targets will group their arguments into one when executing
the command line. That will be done before it is appended to the
targetProcessPrefix().

The escaping and grouping will be done by a new
Target.ScriptBuilder class, instances of which will be created
by a Target.newScriptBuilder() method that will make sure that
the ScriptBuilder returned will be appropriate for the target
shell.

It will provide support for specifying inline environment
variables, a working directory and adding tokens to the command
line. It will escape where necessary, e.g. it will not escape
the environment variable name or assignment but will escape the
value. It will escape all the tokens. When asked to construct an
appropriate command line to execute that script it will group
the script contents into one argument and append it to a target
specific prefix.

VmCommandBuilder will use the new ScriptBuilder to build the
command line that it then passes to Command. It will also be
changed to track environment variables explicitly (will use the
existing but unused env field and method) which it will then
pass onto the ScriptBuilder. Finally, it will track the
workingDirectory as well.

DeviceRuntime and HostRuntime will both change how they use
VmCommandBuilder to make use of the env(String, String) method
and the new workingDirectory(File).

Command will remove the processArgs() method and simply take a
copy of its args.

Added new tests for ScriptBuilder.escape(String) method and
a JUnit 4 TestSuite AllTests that can be used to run all the
tests that currently work within an IDE.

Change-Id: I0351c9fd3fe9d42c1b454251cf78ff74fafb08b2
/external/vogar/src/vogar/tasks/RunActionTask.java
539d798ff5beec2119b4bfbbed21f5e9f2988923 29-Jan-2015 Nicolas Geoffray <ngeoffray@google.com> Fix a typo when dealing with timeouts.

BUG: 19165288
Change-Id: I72a49674587f0380cb2adde807431f5f37a5b922
/external/vogar/src/vogar/tasks/RunActionTask.java
f39d9a39bc81bc5750c53fabd2bb9d3bdd1e389a 07-Jan-2013 bdc@google.com <bdc@google.com@aa685c63-decc-881d-cd2b-7fa72aad72e1> Only include Run.resourceClasspath in jvm and host mode, not target mode

git-svn-id: http://vogar.googlecode.com/svn/trunk@286 aa685c63-decc-881d-cd2b-7fa72aad72e1
/external/vogar/src/vogar/tasks/RunActionTask.java
5379730d1295c75e2b7b1c6d193e74ba5f54cf17 04-Dec-2012 enh@google.com <enh@google.com@aa685c63-decc-881d-cd2b-7fa72aad72e1> Automatically add libcore resource directories to the runtime classpath.

Note that I added a new flavor of classpath. You might think I could have
just reused the existing --classpath, but that's supplied at compile time
as well as run time, and there might be all kinds of confusing files in
the resource tree that shouldn't be shown to the compiler. (This is certainly
the case with libcore. You can't build with the resource directories on the
compile time classpath.)



git-svn-id: http://vogar.googlecode.com/svn/trunk@285 aa685c63-decc-881d-cd2b-7fa72aad72e1
/external/vogar/src/vogar/tasks/RunActionTask.java
3b3cf36f62d25eb950f0bf95071a82b83e730a58 20-Dec-2011 jessewilson@google.com <jessewilson@google.com@aa685c63-decc-881d-cd2b-7fa72aad72e1> Fix --stream to run only one test at a time. Otherwise tests are run concurrently and output is interleaved. Use --no-stream to run multiple tests in parallel.

git-svn-id: http://vogar.googlecode.com/svn/trunk@275 aa685c63-decc-881d-cd2b-7fa72aad72e1
/external/vogar/src/vogar/tasks/RunActionTask.java
f83be5e4273263df2bb9ef609946b911695b3996 02-Dec-2011 jessewilson@google.com <jessewilson@google.com@aa685c63-decc-881d-cd2b-7fa72aad72e1> Use tasks everywhere.

I still need to smash together the 'Run' and 'Vogar' classes; this is an intermediate step on the way to removing miniguice DI from vogar.

git-svn-id: http://vogar.googlecode.com/svn/trunk@263 aa685c63-decc-881d-cd2b-7fa72aad72e1
/external/vogar/src/vogar/tasks/RunActionTask.java
2c37ef5a628067f4d7e5a5c69a7314647939a5e1 01-Dec-2011 jessewilson@google.com <jessewilson@google.com@aa685c63-decc-881d-cd2b-7fa72aad72e1> Another intermediate step in refactoring vogar.

This bets more heavily on tasks, but doesn't quite get to the goal where environments and modes are simply factories for tasks.

git-svn-id: http://vogar.googlecode.com/svn/trunk@262 aa685c63-decc-881d-cd2b-7fa72aad72e1
/external/vogar/src/vogar/tasks/RunActionTask.java
c10fce89841f100758df681ec283c794f5e48d37 30-Nov-2011 jessewilson@google.com <jessewilson@google.com@aa685c63-decc-881d-cd2b-7fa72aad72e1> Intermediate step in refactoring vogar to be composed of tasks. When this is done we should have better parallelism and it should be simpler to introduce newer, more sophisticated modes.

git-svn-id: http://vogar.googlecode.com/svn/trunk@261 aa685c63-decc-881d-cd2b-7fa72aad72e1
/external/vogar/src/vogar/tasks/RunActionTask.java