OLD | NEW |
---|---|
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:convert'; | 5 import 'dart:convert'; |
6 // We need to use the 'io' prefix here, otherwise io.exitCode will shadow | 6 // We need to use the 'io' prefix here, otherwise io.exitCode will shadow |
7 // CommandOutput.exitCode in subclasses of CommandOutput. | 7 // CommandOutput.exitCode in subclasses of CommandOutput. |
8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
9 | 9 |
10 import 'package:status_file/expectation.dart'; | 10 import 'package:status_file/expectation.dart'; |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
691 assert(exitCode != 0); | 691 assert(exitCode != 0); |
692 return Expectation.compileTimeError; | 692 return Expectation.compileTimeError; |
693 } | 693 } |
694 | 694 |
695 var outcome = | 695 var outcome = |
696 exitCode == 0 ? Expectation.pass : Expectation.compileTimeError; | 696 exitCode == 0 ? Expectation.pass : Expectation.compileTimeError; |
697 return _negateOutcomeIfNegativeTest(outcome, testCase.isNegative); | 697 return _negateOutcomeIfNegativeTest(outcome, testCase.isNegative); |
698 } | 698 } |
699 } | 699 } |
700 | 700 |
701 class DevCompilerCommandOutput extends CommandOutput { | |
702 DevCompilerCommandOutput( | |
703 Command command, | |
704 int exitCode, | |
705 bool timedOut, | |
706 List<int> stdout, | |
707 List<int> stderr, | |
708 Duration time, | |
709 bool compilationSkipped, | |
710 int pid) | |
711 : super(command, exitCode, timedOut, stdout, stderr, time, | |
712 compilationSkipped, pid); | |
713 | |
714 Expectation result(TestCase testCase) { | |
715 if (hasCrashed) return Expectation.crash; | |
716 if (hasTimedOut) return Expectation.timeout; | |
717 if (hasNonUtf8) return Expectation.nonUtf8Error; | |
718 | |
719 // Handle errors / missing errors | |
720 if (testCase.expectCompileError) { | |
721 return exitCode != 0 | |
Bob Nystrom
2017/08/03 18:28:04
How about "== 0" and flipping the cases to avoid t
Jennifer Messerly
2017/08/03 19:43:06
Done.
| |
722 ? Expectation.pass | |
723 : Expectation.missingCompileTimeError; | |
724 } | |
725 | |
726 // TODO(jmesserly): should we handle `testCase.isNegative`? Analyzer does | |
727 // not, so this behavior is chosen to match. | |
728 return exitCode == 0 ? Expectation.pass : Expectation.compileTimeError; | |
729 } | |
730 } | |
731 | |
701 class KernelCompilationCommandOutput extends CompilationCommandOutput { | 732 class KernelCompilationCommandOutput extends CompilationCommandOutput { |
702 KernelCompilationCommandOutput( | 733 KernelCompilationCommandOutput( |
703 Command command, | 734 Command command, |
704 int exitCode, | 735 int exitCode, |
705 bool timedOut, | 736 bool timedOut, |
706 List<int> stdout, | 737 List<int> stdout, |
707 List<int> stderr, | 738 List<int> stderr, |
708 Duration time, | 739 Duration time, |
709 bool compilationSkipped) | 740 bool compilationSkipped) |
710 : super(command, exitCode, timedOut, stdout, stderr, time, | 741 : super(command, exitCode, timedOut, stdout, stderr, time, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
797 return new KernelCompilationCommandOutput( | 828 return new KernelCompilationCommandOutput( |
798 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped); | 829 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped); |
799 } else if (command is AdbPrecompilationCommand) { | 830 } else if (command is AdbPrecompilationCommand) { |
800 return new VMCommandOutput( | 831 return new VMCommandOutput( |
801 command, exitCode, timedOut, stdout, stderr, time, pid); | 832 command, exitCode, timedOut, stdout, stderr, time, pid); |
802 } else if (command is CompilationCommand) { | 833 } else if (command is CompilationCommand) { |
803 if (command.displayName == 'precompiler' || | 834 if (command.displayName == 'precompiler' || |
804 command.displayName == 'app_jit') { | 835 command.displayName == 'app_jit') { |
805 return new VMCommandOutput( | 836 return new VMCommandOutput( |
806 command, exitCode, timedOut, stdout, stderr, time, pid); | 837 command, exitCode, timedOut, stdout, stderr, time, pid); |
838 } else if (command.displayName == 'dartdevc') { | |
839 return new DevCompilerCommandOutput(command, exitCode, timedOut, stdout, | |
840 stderr, time, compilationSkipped, pid); | |
807 } | 841 } |
808 return new CompilationCommandOutput( | 842 return new CompilationCommandOutput( |
809 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped); | 843 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped); |
810 } else if (command is JSCommandlineCommand) { | 844 } else if (command is JSCommandlineCommand) { |
811 return new JSCommandLineOutput( | 845 return new JSCommandLineOutput( |
812 command, exitCode, timedOut, stdout, stderr, time); | 846 command, exitCode, timedOut, stdout, stderr, time); |
813 } | 847 } |
814 | 848 |
815 return new CommandOutput(command, exitCode, timedOut, stdout, stderr, time, | 849 return new CommandOutput(command, exitCode, timedOut, stdout, stderr, time, |
816 compilationSkipped, pid); | 850 compilationSkipped, pid); |
(...skipping 14 matching lines...) Expand all Loading... | |
831 // complete successfully, it's outcome is Expectation.FAIL. | 865 // complete successfully, it's outcome is Expectation.FAIL. |
832 // TODO: maybe we should introduce a AsyncIncomplete marker or so | 866 // TODO: maybe we should introduce a AsyncIncomplete marker or so |
833 if (outcome == Expectation.pass) { | 867 if (outcome == Expectation.pass) { |
834 if (_isAsyncTest(testOutput) && !_isAsyncTestSuccessful(testOutput)) { | 868 if (_isAsyncTest(testOutput) && !_isAsyncTestSuccessful(testOutput)) { |
835 return Expectation.fail; | 869 return Expectation.fail; |
836 } | 870 } |
837 } | 871 } |
838 return outcome; | 872 return outcome; |
839 } | 873 } |
840 } | 874 } |
OLD | NEW |