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
_EXTRA_COMMAND_LINE_FILE = (
'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):
......@@ -61,8 +57,6 @@ class RemoteDeviceGtestTestRun(remote_device_test_run.RemoteDeviceTestRun):
env_vars[_EXTRA_COMMAND_LINE_FILE] = os.path.basename(flag_file.name)
self._test_instance._data_deps.append(
(os.path.abspath(flag_file.name), None))
if self._env.only_output_failures:
env_vars[_EXTRA_ONLY_OUTPUT_FAILURES] = None
self._AmInstrumentTestSetup(
dummy_app_path, self._test_instance.apk, runner_package,
environment_variables=env_vars)
......
......@@ -31,10 +31,6 @@ import java.util.regex.Pattern;
* An Instrumentation that runs tests based on NativeTestActivity.
*/
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");
......@@ -46,7 +42,6 @@ public class NativeTestInstrumentationTestRunner extends Instrumentation {
private File mStdoutFile;
private Bundle mLogBundle;
private ResultsBundleGenerator mBundleGenerator;
private boolean mOnlyOutputFailures;
@Override
public void onCreate(Bundle arguments) {
......@@ -63,7 +58,6 @@ public class NativeTestInstrumentationTestRunner extends Instrumentation {
}
mLogBundle = new Bundle();
mBundleGenerator = new RobotiumBundleGenerator();
mOnlyOutputFailures = arguments.containsKey(EXTRA_ONLY_OUTPUT_FAILURES);
start();
}
......@@ -139,26 +133,17 @@ public class NativeTestInstrumentationTestRunner extends Instrumentation {
for (String l = r.readLine(); l != null && !l.equals("<<ScopedMainEntryLogger");
l = r.readLine()) {
Matcher m = RE_TEST_OUTPUT.matcher(l);
boolean isFailure = false;
if (m.matches()) {
if (m.group(1).equals("RUN")) {
results.put(m.group(2), ResultsBundleGenerator.TestResult.UNKNOWN);
} else if (m.group(1).equals("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")) {
results.put(m.group(2), ResultsBundleGenerator.TestResult.PASSED);
}
}
// TODO(jbudorick): mOnlyOutputFailures is a workaround for b/18981674. Remove it
// once that issue is fixed.
if (!mOnlyOutputFailures || isFailure) {
mLogBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, l + "\n");
sendStatus(0, mLogBundle);
}
mLogBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, l + "\n");
sendStatus(0, mLogBundle);
Log.i(TAG, l);
}
} 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