Commit 803ff930 authored by mikecase's avatar mikecase Committed by Commit bot

Enable ouputting results for passed tests on AMP.

AMP had a bug outputting results if the output stream was too
large. Therefore, we only were outputting test results for failed
tests. This issue has been fixed (b/18981674) and this CL is to
enable full test result outputting on AMP.

BUG=

Review URL: https://codereview.chromium.org/1023803002

Cr-Commit-Position: refs/heads/master@{#330892}
parent 30c2379b
...@@ -18,10 +18,6 @@ from pylib.remote.device import remote_device_helper ...@@ -18,10 +18,6 @@ from pylib.remote.device import remote_device_helper
_EXTRA_COMMAND_LINE_FILE = ( _EXTRA_COMMAND_LINE_FILE = (
'org.chromium.native_test.NativeTestActivity.CommandLineFile') 'org.chromium.native_test.NativeTestActivity.CommandLineFile')
# TODO(jbudorick): Remove this extra when b/18981674 is fixed.
_EXTRA_ONLY_OUTPUT_FAILURES = (
'org.chromium.native_test.NativeTestInstrumentationTestRunner.'
'OnlyOutputFailures')
class RemoteDeviceGtestTestRun(remote_device_test_run.RemoteDeviceTestRun): class RemoteDeviceGtestTestRun(remote_device_test_run.RemoteDeviceTestRun):
...@@ -61,8 +57,6 @@ class RemoteDeviceGtestTestRun(remote_device_test_run.RemoteDeviceTestRun): ...@@ -61,8 +57,6 @@ class RemoteDeviceGtestTestRun(remote_device_test_run.RemoteDeviceTestRun):
env_vars[_EXTRA_COMMAND_LINE_FILE] = os.path.basename(flag_file.name) env_vars[_EXTRA_COMMAND_LINE_FILE] = os.path.basename(flag_file.name)
self._test_instance._data_deps.append( self._test_instance._data_deps.append(
(os.path.abspath(flag_file.name), None)) (os.path.abspath(flag_file.name), None))
if self._env.only_output_failures:
env_vars[_EXTRA_ONLY_OUTPUT_FAILURES] = None
self._AmInstrumentTestSetup( self._AmInstrumentTestSetup(
dummy_app_path, self._test_instance.apk, runner_package, dummy_app_path, self._test_instance.apk, runner_package,
environment_variables=env_vars) environment_variables=env_vars)
......
...@@ -31,10 +31,6 @@ import java.util.regex.Pattern; ...@@ -31,10 +31,6 @@ import java.util.regex.Pattern;
* An Instrumentation that runs tests based on NativeTestActivity. * An Instrumentation that runs tests based on NativeTestActivity.
*/ */
public class NativeTestInstrumentationTestRunner extends Instrumentation { public class NativeTestInstrumentationTestRunner extends Instrumentation {
// TODO(jbudorick): Remove this extra when b/18981674 is fixed.
public static final String EXTRA_ONLY_OUTPUT_FAILURES =
"org.chromium.native_test.NativeTestInstrumentationTestRunner."
+ "OnlyOutputFailures";
private static final String TAG = Log.makeTag("native_test"); private static final String TAG = Log.makeTag("native_test");
...@@ -46,7 +42,6 @@ public class NativeTestInstrumentationTestRunner extends Instrumentation { ...@@ -46,7 +42,6 @@ public class NativeTestInstrumentationTestRunner extends Instrumentation {
private File mStdoutFile; private File mStdoutFile;
private Bundle mLogBundle; private Bundle mLogBundle;
private ResultsBundleGenerator mBundleGenerator; private ResultsBundleGenerator mBundleGenerator;
private boolean mOnlyOutputFailures;
@Override @Override
public void onCreate(Bundle arguments) { public void onCreate(Bundle arguments) {
...@@ -63,7 +58,6 @@ public class NativeTestInstrumentationTestRunner extends Instrumentation { ...@@ -63,7 +58,6 @@ public class NativeTestInstrumentationTestRunner extends Instrumentation {
} }
mLogBundle = new Bundle(); mLogBundle = new Bundle();
mBundleGenerator = new RobotiumBundleGenerator(); mBundleGenerator = new RobotiumBundleGenerator();
mOnlyOutputFailures = arguments.containsKey(EXTRA_ONLY_OUTPUT_FAILURES);
start(); start();
} }
...@@ -139,26 +133,17 @@ public class NativeTestInstrumentationTestRunner extends Instrumentation { ...@@ -139,26 +133,17 @@ public class NativeTestInstrumentationTestRunner extends Instrumentation {
for (String l = r.readLine(); l != null && !l.equals("<<ScopedMainEntryLogger"); for (String l = r.readLine(); l != null && !l.equals("<<ScopedMainEntryLogger");
l = r.readLine()) { l = r.readLine()) {
Matcher m = RE_TEST_OUTPUT.matcher(l); Matcher m = RE_TEST_OUTPUT.matcher(l);
boolean isFailure = false;
if (m.matches()) { if (m.matches()) {
if (m.group(1).equals("RUN")) { if (m.group(1).equals("RUN")) {
results.put(m.group(2), ResultsBundleGenerator.TestResult.UNKNOWN); results.put(m.group(2), ResultsBundleGenerator.TestResult.UNKNOWN);
} else if (m.group(1).equals("FAILED")) { } else if (m.group(1).equals("FAILED")) {
results.put(m.group(2), ResultsBundleGenerator.TestResult.FAILED); results.put(m.group(2), ResultsBundleGenerator.TestResult.FAILED);
isFailure = true;
mLogBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, l + "\n");
sendStatus(0, mLogBundle);
} else if (m.group(1).equals("OK")) { } else if (m.group(1).equals("OK")) {
results.put(m.group(2), ResultsBundleGenerator.TestResult.PASSED); results.put(m.group(2), ResultsBundleGenerator.TestResult.PASSED);
} }
} }
mLogBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, l + "\n");
// TODO(jbudorick): mOnlyOutputFailures is a workaround for b/18981674. Remove it sendStatus(0, mLogBundle);
// once that issue is fixed.
if (!mOnlyOutputFailures || isFailure) {
mLogBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, l + "\n");
sendStatus(0, mLogBundle);
}
Log.i(TAG, l); Log.i(TAG, l);
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment