From 1bc8cdabc1ae8fd8bac30bbd1875b8a53802d736 Mon Sep 17 00:00:00 2001 From: MrKevinWeiss Date: Mon, 6 Mar 2023 13:58:59 +0100 Subject: [PATCH 1/4] tools/compile_like_murdock: Ignore warning from info-* --- dist/tools/compile_test/compile_like_murdock.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/tools/compile_test/compile_like_murdock.py b/dist/tools/compile_test/compile_like_murdock.py index 9cb7124822..441f7ce58b 100755 --- a/dist/tools/compile_test/compile_like_murdock.py +++ b/dist/tools/compile_test/compile_like_murdock.py @@ -136,13 +136,13 @@ def _end(sec, job): def _all_apps(cwd): cmd = ['make', 'info-applications', '--no-print-directory'] - out = subprocess.check_output(cmd, cwd=cwd) + out = subprocess.check_output(cmd, cwd=cwd, stderr=subprocess.DEVNULL) return out.decode("utf-8", errors="replace").split() def _supported_boards(boards, env, cwd): cmd = ['make', 'info-boards-supported', '--no-print-directory'] - out = subprocess.check_output(cmd, env=env, cwd=cwd) + out = subprocess.check_output(cmd, env=env, cwd=cwd, stderr=subprocess.DEVNULL) supported_boards = out.decode("utf-8", errors="replace").split() return [brd for brd in supported_boards if brd in boards] @@ -150,7 +150,7 @@ def _supported_boards(boards, env, cwd): def _supported_boards_from_cpu(cpu, env, cwd): cmd = (f'FEATURES_REQUIRED=cpu_{cpu} make info-boards-supported ' '--no-print-directory') - out = subprocess.check_output(cmd, shell=True, env=env, cwd=cwd) + out = subprocess.check_output(cmd, shell=True, env=env, cwd=cwd, stderr=subprocess.DEVNULL) return out.decode("utf-8", errors="replace").split() From 57899387a0e8344495b4066b0577d9f0ec467b60 Mon Sep 17 00:00:00 2001 From: MrKevinWeiss Date: Mon, 6 Mar 2023 13:59:46 +0100 Subject: [PATCH 2/4] tools/compile_like_murdock: Allow 'all' boards --- dist/tools/compile_test/compile_like_murdock.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dist/tools/compile_test/compile_like_murdock.py b/dist/tools/compile_test/compile_like_murdock.py index 441f7ce58b..34338a224c 100755 --- a/dist/tools/compile_test/compile_like_murdock.py +++ b/dist/tools/compile_test/compile_like_murdock.py @@ -140,10 +140,12 @@ def _all_apps(cwd): return out.decode("utf-8", errors="replace").split() -def _supported_boards(boards, env, cwd): +def _supported_boards(boards, env, cwd, all_boards=False): cmd = ['make', 'info-boards-supported', '--no-print-directory'] out = subprocess.check_output(cmd, env=env, cwd=cwd, stderr=subprocess.DEVNULL) supported_boards = out.decode("utf-8", errors="replace").split() + if all_boards: + return supported_boards return [brd for brd in supported_boards if brd in boards] @@ -181,7 +183,8 @@ def main(): help=("Optional boards list, will test all supported " "boards on the list. Will override the cpu " "filter. If empty, a subset of boards will be " - "selected for you...")) + "selected for you. If 'all' then it will test " + "all supported boards.")) parser.add_argument("-c", "--cpu", type=str, help=("Optional filter for all supported boards " "belonging to the cpu family, for example, " @@ -217,8 +220,10 @@ def main(): if args.cpu: target_boards = _supported_boards_from_cpu(args.cpu, full_env, test_dir) + elif args.boards[0] == "all": + target_boards = _supported_boards(boards, full_env, test_dir, True) else: - target_boards = _supported_boards(boards, full_env, test_dir) + target_boards = _supported_boards(boards, full_env, test_dir, False) for board in target_boards: if args.dry_run: print(f"{app: <30} {board: <30}") From df3f0ce71c7c5f81e442f0252e5eb401dbf0e86c Mon Sep 17 00:00:00 2001 From: MrKevinWeiss Date: Mon, 6 Mar 2023 14:00:21 +0100 Subject: [PATCH 3/4] tools/compile_like_murdock: -v -vv -vvv verbosity settings --- .../compile_test/compile_like_murdock.py | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/dist/tools/compile_test/compile_like_murdock.py b/dist/tools/compile_test/compile_like_murdock.py index 34338a224c..6e6c4bd98a 100755 --- a/dist/tools/compile_test/compile_like_murdock.py +++ b/dist/tools/compile_test/compile_like_murdock.py @@ -156,19 +156,28 @@ def _supported_boards_from_cpu(cpu, env, cwd): return out.decode("utf-8", errors="replace").split() -def _build(app, board, jobs, env, cwd): +def _build(app, board, jobs, env, cwd, args): cmd = (f'/bin/bash -c "source .murdock; JOBS={jobs} ' f'compile {app} {board}:gnu"') try: out = subprocess.check_output(cmd, env=env, shell=True, cwd=cwd, stderr=subprocess.STDOUT) out = out.decode("utf-8", errors="replace") + if args.very_very_verbose: + print(out) print(f"{app: <30} {board: <30} PASS") except subprocess.CalledProcessError as err: err.output = err.output.decode("utf-8", errors="replace") lines = err.output.split("\n") - + if args.very_very_verbose or args.very_verbose: + print(err.output) if lines[-3].startswith('< ') or lines[-3].startswith('> '): + if args.verbose: + for line in lines: + if line.startswith('< '): + print("make has:", line[2:]) + if line.startswith('> '): + print("kconfig has:", line[2:]) print(f"{app: <30} {board: <30} FAIL: Kconfig module or pkg " "mismatch") elif "mismatch" in err.output: @@ -200,6 +209,13 @@ def main(): " without spending super long to compile them")) parser.add_argument("-j", "--jobs", type=int, default=4, help=("The amount of jobs to use when compiling.")) + parser.add_argument("-v", "--verbose", action="store_true", + help=("Shows mismatch info.")) + parser.add_argument("-vv", "--very-verbose", action="store_true", + help=("Shows extra output on failures.")) + parser.add_argument("-vvv", "--very-very-verbose", action="store_true", + help=("Shows all output info.")) + args = parser.parse_args() start_time = datetime.datetime.now() @@ -228,7 +244,7 @@ def main(): if args.dry_run: print(f"{app: <30} {board: <30}") else: - _build(app, board, args.jobs, full_env, riot_dir) + _build(app, board, args.jobs, full_env, riot_dir, args) elapse_time = datetime.datetime.now() - start_time _end(elapse_time.total_seconds(), args.jobs) From c9cfd27d3bcaa1deaee1b4e6eab50aab01957f89 Mon Sep 17 00:00:00 2001 From: MrKevinWeiss Date: Mon, 6 Mar 2023 15:13:46 +0100 Subject: [PATCH 4/4] tools/compile_like_murdock: Add -m to only check mod/pkgs --- .../compile_test/compile_like_murdock.py | 77 ++++++++++++++----- 1 file changed, 57 insertions(+), 20 deletions(-) diff --git a/dist/tools/compile_test/compile_like_murdock.py b/dist/tools/compile_test/compile_like_murdock.py index 6e6c4bd98a..ba1caeeb9a 100755 --- a/dist/tools/compile_test/compile_like_murdock.py +++ b/dist/tools/compile_test/compile_like_murdock.py @@ -134,16 +134,28 @@ def _end(sec, job): print(f"You could have {val} {thing}") +def __exec_cmd(cmd, shell=False, env=None, cwd=None, + stderr=subprocess.DEVNULL): + out = subprocess.run( + cmd, + shell=shell, + env=env, + cwd=cwd, + stderr=stderr, + check=True, + stdout=subprocess.PIPE, + ).stdout + return out.decode("utf-8", errors="replace") + + def _all_apps(cwd): - cmd = ['make', 'info-applications', '--no-print-directory'] - out = subprocess.check_output(cmd, cwd=cwd, stderr=subprocess.DEVNULL) - return out.decode("utf-8", errors="replace").split() + cmd = ('make', 'info-applications', '--no-print-directory') + return __exec_cmd(cmd, cwd=cwd).split() def _supported_boards(boards, env, cwd, all_boards=False): - cmd = ['make', 'info-boards-supported', '--no-print-directory'] - out = subprocess.check_output(cmd, env=env, cwd=cwd, stderr=subprocess.DEVNULL) - supported_boards = out.decode("utf-8", errors="replace").split() + cmd = ('make', 'info-boards-supported', '--no-print-directory') + supported_boards = __exec_cmd(cmd, env=env, cwd=cwd).split() if all_boards: return supported_boards return [brd for brd in supported_boards if brd in boards] @@ -152,17 +164,42 @@ def _supported_boards(boards, env, cwd, all_boards=False): def _supported_boards_from_cpu(cpu, env, cwd): cmd = (f'FEATURES_REQUIRED=cpu_{cpu} make info-boards-supported ' '--no-print-directory') - out = subprocess.check_output(cmd, shell=True, env=env, cwd=cwd, stderr=subprocess.DEVNULL) - return out.decode("utf-8", errors="replace").split() + __exec_cmd(cmd, shell=True, env=env, cwd=cwd).split() + + +def _print_module_or_pkg_mismatch(app, board, lines, args): + if args.verbose: + for line in lines: + # Reprint the < and > from diff to show if kconfig or make are + # responsible + if line.startswith('< '): + print(" make has:", line[2:]) + if line.startswith('> '): + print(" kconfig has:", line[2:]) + print(f"{app: <30} {board: <30} FAIL: Kconfig module or pkg mismatch") + + +def _modules_packages(app, board, jobs, env, cwd, args): + cmd = (f'/bin/bash -c "source .murdock; JOBS={jobs} ' + f'kconfig_module_packages_diff {board} {app}"') + try: + out = __exec_cmd(cmd, shell=True, env=env, cwd=cwd, + stderr=subprocess.STDOUT) + if args.very_very_verbose: + print(out) + print(f"{app: <30} {board: <30} PASS") + except subprocess.CalledProcessError as err: + err.output = err.output.decode("utf-8", errors="replace") + lines = err.output.split("\n") + _print_module_or_pkg_mismatch(app, board, lines, args) def _build(app, board, jobs, env, cwd, args): cmd = (f'/bin/bash -c "source .murdock; JOBS={jobs} ' f'compile {app} {board}:gnu"') try: - out = subprocess.check_output(cmd, env=env, shell=True, - cwd=cwd, stderr=subprocess.STDOUT) - out = out.decode("utf-8", errors="replace") + out = __exec_cmd(cmd, shell=True, env=env, cwd=cwd, + stderr=subprocess.STDOUT) if args.very_very_verbose: print(out) print(f"{app: <30} {board: <30} PASS") @@ -171,15 +208,9 @@ def _build(app, board, jobs, env, cwd, args): lines = err.output.split("\n") if args.very_very_verbose or args.very_verbose: print(err.output) + # Check for known diff error outputs if lines[-3].startswith('< ') or lines[-3].startswith('> '): - if args.verbose: - for line in lines: - if line.startswith('< '): - print("make has:", line[2:]) - if line.startswith('> '): - print("kconfig has:", line[2:]) - print(f"{app: <30} {board: <30} FAIL: Kconfig module or pkg " - "mismatch") + _print_module_or_pkg_mismatch(app, board, lines, args) elif "mismatch" in err.output: print(f"{app: <30} {board: <30} FAIL: Kconfig hash mismatch") else: @@ -209,6 +240,8 @@ def main(): " without spending super long to compile them")) parser.add_argument("-j", "--jobs", type=int, default=4, help=("The amount of jobs to use when compiling.")) + parser.add_argument("-m", "--modules-packages", action="store_true", + help=("Only check the diff of modules and packages.")) parser.add_argument("-v", "--verbose", action="store_true", help=("Shows mismatch info.")) parser.add_argument("-vv", "--very-verbose", action="store_true", @@ -239,10 +272,14 @@ def main(): elif args.boards[0] == "all": target_boards = _supported_boards(boards, full_env, test_dir, True) else: - target_boards = _supported_boards(boards, full_env, test_dir, False) + target_boards = _supported_boards(boards, full_env, test_dir, + False) for board in target_boards: if args.dry_run: print(f"{app: <30} {board: <30}") + elif args.modules_packages: + _modules_packages(app, board, args.jobs, full_env, riot_dir, + args) else: _build(app, board, args.jobs, full_env, riot_dir, args) elapse_time = datetime.datetime.now() - start_time