|
10 | 10 | from common.models import Scheme, JdkInfo
|
11 | 11 | from common.utils import to_shallow_dict, DEFAULT_TARGET
|
12 | 12 |
|
| 13 | +class ErrorTrackingHandler(logging.Handler): |
| 14 | + def __init__(self): |
| 15 | + super().__init__() |
| 16 | + self.error_logged = False |
| 17 | + |
| 18 | + def emit(self, record): |
| 19 | + if record.levelno >= logging.ERROR: |
| 20 | + self.error_logged = True |
| 21 | + |
13 | 22 | logging.basicConfig(
|
14 | 23 | format="%(levelname)s - %(message)s"
|
15 | 24 | )
|
16 | 25 | LOG = logging.getLogger()
|
| 26 | +ERROR_TRACKER = ErrorTrackingHandler() |
| 27 | +LOG.addHandler(ERROR_TRACKER) |
17 | 28 |
|
18 | 29 | OS_EXCEPTIONS = {
|
19 | 30 | "macosx": "mac",
|
|
26 | 37 | "x86": "x86-32",
|
27 | 38 | }
|
28 | 39 |
|
29 |
| - |
30 | 40 | class ExclusionFileProcessingException(Exception):
|
31 | 41 | pass
|
32 | 42 |
|
@@ -112,7 +122,7 @@ class TestExclusionSplitLine(TestExclusionRawLine):
|
112 | 122 |
|
113 | 123 | @classmethod
|
114 | 124 | def from_raw_line(cls, test_excl: TestExclusionRawLine):
|
115 |
| - split_line = test_excl.raw_line.split(maxsplit=2) |
| 125 | + split_line = test_excl.raw_line.split() |
116 | 126 | if len(split_line) != 3:
|
117 | 127 | raise TestExclusionProcessingException(
|
118 | 128 | f'Not exactly 3 elements when splitting {test_excl.raw_line}', test_excl)
|
@@ -185,7 +195,6 @@ def transform_platform(os_arch_platform: str) -> str:
|
185 | 195 |
|
186 | 196 | return f"{arch_name}_{os_name}"
|
187 | 197 |
|
188 |
| - |
189 | 198 | def resolve_platforms(split: TestExclusionSplitLine) -> List[str]:
|
190 | 199 | revolved_platforms = []
|
191 | 200 | list_of_unresolved_platform_names = [s.strip() for s in split.raw_platform.split(",") if s.strip()]
|
@@ -250,11 +259,10 @@ def main():
|
250 | 259 | if args.verbose:
|
251 | 260 | LOG.setLevel(logging.DEBUG)
|
252 | 261 |
|
253 |
| - # if the dir containing the exclude ProblemList*.txt is not passed, the attempt to use openjdk/excludes/ dir instead |
254 | 262 | if args.exclude_dir:
|
255 | 263 | LOG.debug("Taking file list from directory")
|
256 |
| - exclude_files = [os.path.join(args.exclude_dir, file_name) |
257 |
| - for file_name in os.listdir(args.exclude_dir)] |
| 264 | + exclude_files = [os.path.join(args.exclude_dir, f) for f in os.listdir(args.exclude_dir) if os.path.isfile(os.path.join(args.exclude_dir, f))] |
| 265 | + LOG.debug(exclude_files) |
258 | 266 | else:
|
259 | 267 | LOG.debug("Taking file list from stdin")
|
260 | 268 | exclude_files = [line.rstrip() for line in sys.stdin.readlines()] # remove the \n from each lines
|
@@ -283,7 +291,9 @@ def main():
|
283 | 291 | fp=fp,
|
284 | 292 | indent=2,
|
285 | 293 | )
|
286 |
| - |
| 294 | + if ERROR_TRACKER.error_logged: |
| 295 | + LOG.debug(f"Error found. Exiting with code 1") |
| 296 | + sys.exit(1) |
287 | 297 |
|
288 | 298 | if __name__ == '__main__':
|
289 | 299 | main()
|
0 commit comments