History log of /external/vogar/test/vogar/android/AbstractModeTest.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
639824094881c66cca8ca0fb802b93eb5b5072c7 19-Oct-2017 Neil Fuller <nfuller@google.com> Adding an enum for toolchain

Tidying up. Likely to be useful when adding
d8 support, and eventually for removing jack
support.

Added an explicit toolchain for javac
(toolchain=javac) which is forced if mode=jvm.

Renamed --toolchain=jdk to --toolchain=dx to
make the dx vs d8 more obvious: both will use
javac.

Ran vogar tests with:

make vogar-tests && java -cp ${ANDROID_BUILD_TOP}/out/host/linux-x86/framework/vogar-tests.jar \
org.junit.runner.JUnitCore vogar.AllTests

Bug: 67934307
Test: Ran vogar with --mode jvm [|--toolchain dx]
Test: Ran vogar with --mode device [|--toolchain jack|--toolchain dx]
Test: See above
Change-Id: Ieaee1bbe8092318ebf54987494a88a2b91a2d33f
/external/vogar/test/vogar/android/AbstractModeTest.java
0585c04e4930e6811cb7322f522bb0b807991da7 07-Jun-2017 Igor Murashkin <iam@google.com> android: Add support for 1.8 javac and desugar

Using --toolchain jdk will now pass the correct dx minimum api level
(enabling it to use default methods, method handles, etc).

Vogar also now calls desugar before dx to convert invoke-dynamic lambdas
into anonymous inner class lambdas (because Android does not have
a LambdaMetafactory).

Test: art/tools/run-libcore-tests.sh --mode=host
Test: art/tools/run-libcore-tests.sh --mode=device
Test: vogar --toolchain jdk --mode activity --no-multidex libcore/luni/src/test/java/libcore/java/lang/ShortTest.java
Test: vogar --toolchain jdk --benchmark --mode device libcore/benchmarks/src/benchmarks/InvokeInterface.java
Test: java -cp ${ANDROID_BUILD_TOP}/out/host/linux-x86/framework/vogar-tests.jar org.junit.runner.JUnitCore vogar.AllTests
Bug: 36902714
Bug: 37461882
Change-Id: I9553e8304c269cd7e4e2b989729d785852e85f4e
/external/vogar/test/vogar/android/AbstractModeTest.java
728771c453dcc68636ebb5944deccd843aceba0c 27-Nov-2015 Paul Duffin <paulduffin@google.com> Add a mechanism to allow tests to specify arguments for Vogar

Vogar supports dozens of different flags and via Run it is tied
in quite tightly into most of the code. Until such time as the
code had been refactored it is necessary when writing tests to
specify some arguments to Vogar. That tight coupling makes it
difficult to provide test specific arguments to Vogar in a clean
way because at the time the test method itself runs Vogar and a
number of other classes have already been created.

Fortunately, JUnit 4 provides a mechanism (MethodRule) to allow
a test method (or an @Before method) access to annotations on
the test method itself. That provides a nice clean way for a
test method to specify the arguments for Vogar.

This adds VogarArgs annotation to specify the arguments and
VogarArgsRule to retrieve them.

Change-Id: I8252d1b00b436f9f9e7e315e3cf2831c3b735cfa
/external/vogar/test/vogar/android/AbstractModeTest.java
7029503206e4c89fe167c3389c1062d89cf35c52 19-Nov-2015 Paul Duffin <paulduffin@google.com> Refactoring to make more testable

Prior to making a change in the behaviour to fix an issue with
the quoting of command line arguments this refactors the
existing code and adds some tests to illustrate the existing
behaviour. This will minimize the chances that the fix will
break existing code.

The changes are explained below in more detail.

This applied a couple of common refactorings to a number of
classes:
* Where classes were creating a lot of subsidiary objects in
their constructor I switched to using the dependency injection
pattern (i.e. passing in parameters to the constructor). That
makes it easier for tests to override the behaviour.

* Where classes were being given a huge object (e.g. Run) but
only required a small number of it's fields I replaced the Run
constructor parameter with the individual parts.

LocalTarget - Replaced Run with Log, Mkdir, Rm.

Run - Passed in more parameters into the constructor, moved the
code that created those objects into Vogar.run(). Also, make the
vogarJar() method work when running from a class directory to
allow it to work from within IDEA as well as when running from
jars.

SshTarget - Removed a bit of duplication of the command line
prefix used to run a script remotely.

Target - Method defaultDeviceDir() was removed and the
implementations were made static and accessed directly from
Vogar. That is necessary to break a dependency cycle; AdbTarget
required AndroidSdk, which required DeviceFileCache, which
required runnerDir, which required Target.defaultDeviceDir().
Previously, that was broken by passing the DeviceFileCache to
the AndroidSdk after construction using the setCaches() method
but that has been removed as part of this refactoring.

Vogar - Made the constructor and parseArgs(String[]) visible for
testing. Moved some of the code from Run's constructor here to
create the values to be passed into its expanded constructor.
TargetType was added to encapsulate the defaultDeviceDir() for
each Target implementation class. That allowed the cycle
described in Target to be broken.

AdbTarget - Replaced Run with individual fields. Moved
functionality from AndroidSdk that's only used by this class
into here (waitForDevice(), ensureDirectory(File), remount(),
rm(File), forwardTcp(int), push() and pull()). Bringing in
push() also required moving the pushCache from AndroidSdk as
well. Added DeviceFilesystem as a parameter to avoid having to
have a reference to AndroidSdk.

AndroidSdk - Moved logic that runs shell commands to calculate
the compilationClasspath and androidJarPath out of the
constructor and into a static method to allow tests to pass
dummy values straight into the constructor. Marked constructor
as VisibleForTesting. Removed setCaches(..) method and
pushCache, passed the HostFileCache straight into the
constructor, marking the dexCache field as final. Added explicit
exception when can't find platforms directory rather than
NullPointerException. Moved methods that are only used by either
AdbTarget or DeviceFileCache into those classes.

DeviceFileCache - Replaced AndroidSdk with DeviceFileSystem and
moved cp(File, File) and mv(File, File) from AndroidSdk into
here.

DeviceRuntime - Added a Supplier<String> parameter to provide
the device user name in order to allow tests to provide their
own. That is needed because otherwise the test will attempt
to connect to a device to determine the user name.

Command - Added method to access the args for testing, moved the
special processing of "-c" option from start() into a method
called from the constructor. That allows the test to verify the
processing of that without actually executing the command.
Cleaned up unused workingDirectory method and some minor
warnings.

Added some tests and fixed a compile issue with the
JUnitRunnerTest.

Change-Id: Ib1676ee19a4f0e7a8944b2708a6dbe3899d1d292
/external/vogar/test/vogar/android/AbstractModeTest.java