|
63 | 63 | walk_network_integration_targets,
|
64 | 64 | walk_windows_integration_targets,
|
65 | 65 | walk_units_targets,
|
66 |
| - walk_compile_targets, |
67 | 66 | )
|
68 | 67 |
|
69 | 68 | from lib.changes import (
|
|
82 | 81 | from lib.config import (
|
83 | 82 | TestConfig,
|
84 | 83 | EnvironmentConfig,
|
85 |
| - CompileConfig, |
86 | 84 | IntegrationConfig,
|
87 | 85 | NetworkIntegrationConfig,
|
88 | 86 | PosixIntegrationConfig,
|
|
91 | 89 | WindowsIntegrationConfig,
|
92 | 90 | )
|
93 | 91 |
|
94 |
| -from lib.test import ( |
95 |
| - TestMessage, |
96 |
| - TestSuccess, |
97 |
| - TestFailure, |
98 |
| - TestSkipped, |
99 |
| -) |
100 |
| - |
101 | 92 | SUPPORTED_PYTHON_VERSIONS = (
|
102 | 93 | '2.6',
|
103 | 94 | '2.7',
|
|
106 | 97 | '3.7',
|
107 | 98 | )
|
108 | 99 |
|
109 |
| -COMPILE_PYTHON_VERSIONS = SUPPORTED_PYTHON_VERSIONS |
110 |
| - |
111 | 100 |
|
112 | 101 | def check_startup():
|
113 | 102 | """Checks to perform at startup before running commands."""
|
@@ -1024,114 +1013,6 @@ def command_units(args):
|
1024 | 1013 | raise
|
1025 | 1014 |
|
1026 | 1015 |
|
1027 |
| -def command_compile(args): |
1028 |
| - """ |
1029 |
| - :type args: CompileConfig |
1030 |
| - """ |
1031 |
| - changes = get_changes_filter(args) |
1032 |
| - require = (args.require or []) + changes |
1033 |
| - include, exclude = walk_external_targets(walk_compile_targets(), args.include, args.exclude, require) |
1034 |
| - |
1035 |
| - if not include: |
1036 |
| - raise AllTargetsSkipped() |
1037 |
| - |
1038 |
| - if args.delegate: |
1039 |
| - raise Delegate(require=changes) |
1040 |
| - |
1041 |
| - install_command_requirements(args) |
1042 |
| - |
1043 |
| - total = 0 |
1044 |
| - failed = [] |
1045 |
| - |
1046 |
| - for version in COMPILE_PYTHON_VERSIONS: |
1047 |
| - # run all versions unless version given, in which case run only that version |
1048 |
| - if args.python and version != args.python_version: |
1049 |
| - continue |
1050 |
| - |
1051 |
| - display.info('Compile with Python %s' % version) |
1052 |
| - |
1053 |
| - result = compile_version(args, version, include, exclude) |
1054 |
| - result.write(args) |
1055 |
| - |
1056 |
| - total += 1 |
1057 |
| - |
1058 |
| - if isinstance(result, TestFailure): |
1059 |
| - failed.append('compile --python %s' % version) |
1060 |
| - |
1061 |
| - if failed: |
1062 |
| - message = 'The %d compile test(s) listed below (out of %d) failed. See error output above for details.\n%s' % ( |
1063 |
| - len(failed), total, '\n'.join(failed)) |
1064 |
| - |
1065 |
| - if args.failure_ok: |
1066 |
| - display.error(message) |
1067 |
| - else: |
1068 |
| - raise ApplicationError(message) |
1069 |
| - |
1070 |
| - |
1071 |
| -def compile_version(args, python_version, include, exclude): |
1072 |
| - """ |
1073 |
| - :type args: CompileConfig |
1074 |
| - :type python_version: str |
1075 |
| - :type include: tuple[CompletionTarget] |
1076 |
| - :type exclude: tuple[CompletionTarget] |
1077 |
| - :rtype: TestResult |
1078 |
| - """ |
1079 |
| - command = 'compile' |
1080 |
| - test = '' |
1081 |
| - |
1082 |
| - # optional list of regex patterns to exclude from tests |
1083 |
| - skip_file = 'test/compile/python%s-skip.txt' % python_version |
1084 |
| - |
1085 |
| - if os.path.exists(skip_file): |
1086 |
| - with open(skip_file, 'r') as skip_fd: |
1087 |
| - skip_paths = skip_fd.read().splitlines() |
1088 |
| - else: |
1089 |
| - skip_paths = [] |
1090 |
| - |
1091 |
| - # augment file exclusions |
1092 |
| - skip_paths += [e.path for e in exclude] |
1093 |
| - |
1094 |
| - skip_paths = sorted(skip_paths) |
1095 |
| - |
1096 |
| - python = 'python%s' % python_version |
1097 |
| - cmd = [python, 'test/compile/compile.py'] |
1098 |
| - |
1099 |
| - if skip_paths: |
1100 |
| - cmd += ['-x', '|'.join(skip_paths)] |
1101 |
| - |
1102 |
| - cmd += [target.path if target.path == '.' else './%s' % target.path for target in include] |
1103 |
| - |
1104 |
| - try: |
1105 |
| - stdout, stderr = run_command(args, cmd, capture=True) |
1106 |
| - status = 0 |
1107 |
| - except SubprocessError as ex: |
1108 |
| - stdout = ex.stdout |
1109 |
| - stderr = ex.stderr |
1110 |
| - status = ex.status |
1111 |
| - |
1112 |
| - if stderr: |
1113 |
| - raise SubprocessError(cmd=cmd, status=status, stderr=stderr, stdout=stdout) |
1114 |
| - |
1115 |
| - if args.explain: |
1116 |
| - return TestSkipped(command, test, python_version=python_version) |
1117 |
| - |
1118 |
| - pattern = r'^(?P<path>[^:]*):(?P<line>[0-9]+):(?P<column>[0-9]+): (?P<message>.*)$' |
1119 |
| - |
1120 |
| - results = [re.search(pattern, line).groupdict() for line in stdout.splitlines()] |
1121 |
| - |
1122 |
| - results = [TestMessage( |
1123 |
| - message=r['message'], |
1124 |
| - path=r['path'].replace('./', ''), |
1125 |
| - line=int(r['line']), |
1126 |
| - column=int(r['column']), |
1127 |
| - ) for r in results] |
1128 |
| - |
1129 |
| - if results: |
1130 |
| - return TestFailure(command, test, messages=results, python_version=python_version) |
1131 |
| - |
1132 |
| - return TestSuccess(command, test, python_version=python_version) |
1133 |
| - |
1134 |
| - |
1135 | 1016 | def get_changes_filter(args):
|
1136 | 1017 | """
|
1137 | 1018 | :type args: TestConfig
|
|
0 commit comments