Conversation
| # ====================== START MINICOM EARLY FOR FULL UART CAPTURE ====================== | ||
| print(f" Starting minicom capture early on {args.serial_port} @ {args.baud} baud...") |
There was a problem hiding this comment.
| # ====================== START MINICOM EARLY FOR FULL UART CAPTURE ====================== | |
| print(f" Starting minicom capture early on {args.serial_port} @ {args.baud} baud...") | |
| # ====================== START GRABSERIAL EARLY FOR FULL UART CAPTURE ====================== | |
| print(f" Starting grabserial capture early on {args.serial_port} @ {args.baud} baud...") |
| ) | ||
| print(f" grabserial started (PID {logger_proc.pid}) — capturing from now on") | ||
|
|
||
| # Give minicom a moment to open the port and settle |
There was a problem hiding this comment.
| # Give minicom a moment to open the port and settle | |
| # Give grabserial a moment to open the port and settle |
|
|
||
| gdb_cmd = [ | ||
| args.gdb, "--batch", "--nx", full_path, | ||
| "-ex", "target extended-remote localhost:3333", |
There was a problem hiding this comment.
Could you add an argument to support passing a different OpenOCD server, eg
| "-ex", "target extended-remote localhost:3333", | |
| "-ex", f"target extended-remote {args.openocd_server}", |
peterharperuk
left a comment
There was a problem hiding this comment.
I like the idea of this. I suggest using it is the best way to find issues.
The pico test utility still generates passes after some failures have occurred which is a bit annoying. I should push some fixes.
| import signal | ||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser(description="RP2350 ELF test runner with OpenOCD + pyserial UART capture") |
There was a problem hiding this comment.
| parser = argparse.ArgumentParser(description="RP2350 ELF test runner with OpenOCD + pyserial UART capture") | |
| parser = argparse.ArgumentParser(description="RP2xxx ELF test runner with OpenOCD + grabserial UART capture") |
I guess there's no reason why this wouldn't work with RP2040 too?
| custom_float_funcs_test_pico_vfp.elf \ | ||
| --path-postfix \ | ||
| test/pico_float_test \ | ||
| -- out_dir |
There was a problem hiding this comment.
Might be worth splitting this into
| -- out_dir | |
| -- | |
| out_dir |
so that it look less like a typo of --out_dir ?
|
|
||
| for seg in args.path_segments: | ||
| for elf in args.elf_filenames: | ||
| full_path = f"{args.path_prefix}/{seg}/{args.path_postfix}/{elf}" |
There was a problem hiding this comment.
| full_path = f"{args.path_prefix}/{seg}/{args.path_postfix}/{elf}" | |
| full_path = os.path.join(args.path_prefix, seg, args.path_postfix, elf) |
--path-postfix is an optional arg, so using os.path.join means that you won't end up with // in the path.
|
|
||
| args = parser.parse_args() | ||
|
|
||
| os.makedirs(args.output_dir, exist_ok=True) |
There was a problem hiding this comment.
Should it delete and then recreate output_dir, so that we don't get into a confusing state of output_dir containing both "old logs" and "new logs"? (You can use https://docs.python.org/3/library/shutil.html#shutil.rmtree for that)
| continue | ||
|
|
||
| attempted += 1 | ||
| sanitized_out_file = f"{seg}.{elf}.out".replace("/",".") |
There was a problem hiding this comment.
The .replace("/",".") doesn't seem necessary, because the help-text for --path-segments says "(no slashes)" ? (Or does the help-text need updating?)
There was a problem hiding this comment.
Ahhh. but the examples at the top of this file shows that a slash is allowed in the ELF-filenames.
| Which will run the following if they exist, storing the output in out_dir/ | ||
| gcc_build/test/pico_float_test/custom_float_funcs_test_compiler.elf | ||
| gcc_build/test/pico_float_test/custom_float_funcs_test_pico_dcp.elf | ||
| gcc_build/test/pico_float_test/custom_float_funcs_test_pico.elf | ||
| gcc_build/test/pico_float_test/custom_float_funcs_test_pico_vfp.elf | ||
| clang_build/test/pico_float_test/custom_float_funcs_test_compiler.elf | ||
| clang_build/test/pico_float_test/custom_float_funcs_test_pico_dcp.elf | ||
| clang_build/test/pico_float_test/custom_float_funcs_test_pico.elf | ||
| clang_build/test/pico_float_test/custom_float_funcs_test_pico_vfp.elf |
There was a problem hiding this comment.
Might be worth clarify the style of the output filenames?
| Which will run the following if they exist, storing the output in out_dir/ | |
| gcc_build/test/pico_float_test/custom_float_funcs_test_compiler.elf | |
| gcc_build/test/pico_float_test/custom_float_funcs_test_pico_dcp.elf | |
| gcc_build/test/pico_float_test/custom_float_funcs_test_pico.elf | |
| gcc_build/test/pico_float_test/custom_float_funcs_test_pico_vfp.elf | |
| clang_build/test/pico_float_test/custom_float_funcs_test_compiler.elf | |
| clang_build/test/pico_float_test/custom_float_funcs_test_pico_dcp.elf | |
| clang_build/test/pico_float_test/custom_float_funcs_test_pico.elf | |
| clang_build/test/pico_float_test/custom_float_funcs_test_pico_vfp.elf | |
| Which will run each of the following if they exist: | |
| gcc_build/test/pico_float_test/custom_float_funcs_test_compiler.elf | |
| gcc_build/test/pico_float_test/custom_float_funcs_test_pico_dcp.elf | |
| gcc_build/test/pico_float_test/custom_float_funcs_test_pico.elf | |
| gcc_build/test/pico_float_test/custom_float_funcs_test_pico_vfp.elf | |
| clang_build/test/pico_float_test/custom_float_funcs_test_compiler.elf | |
| clang_build/test/pico_float_test/custom_float_funcs_test_pico_dcp.elf | |
| clang_build/test/pico_float_test/custom_float_funcs_test_pico.elf | |
| clang_build/test/pico_float_test/custom_float_funcs_test_pico_vfp.elf | |
| storing their UART output in: | |
| out_dir/gcc_build.custom_float_funcs_test_compiler.elf.out | |
| out_dir/gcc_build.custom_float_funcs_test_pico_dcp.elf.out | |
| out_dir/gcc_build.custom_float_funcs_test_pico.elf.out | |
| out_dir/gcc_build.custom_float_funcs_test_pico_vfp.elf.out | |
| out_dir/clang_build.custom_float_funcs_test_compiler.elf.out | |
| out_dir/clang_build.custom_float_funcs_test_pico_dcp.elf.out | |
| out_dir/clang_build.custom_float_funcs_test_pico.elf.out | |
| out_dir/clang_build.custom_float_funcs_test_pico_vfp.elf.out |
| clang_build/test/pico_float_test/custom_float_funcs_test_pico.elf | ||
| clang_build/test/pico_float_test/custom_float_funcs_test_pico_vfp.elf | ||
|
|
||
| This would run the same tests: |
There was a problem hiding this comment.
| This would run the same tests: | |
| This would run the same tests: | |
| (but store the output in e.g out_dir/gcc_build.pico_float_test.custom_float_funcs_test_compiler.elf.out ) |
| gdb_result = subprocess.run( | ||
| gdb_cmd, | ||
| check=False, | ||
| timeout=60, |
There was a problem hiding this comment.
Maybe it's worth adding an optional-argument for this timeout, in case you have a particularly long-running ELF file? 🤔
| except: | ||
| pass | ||
|
|
||
| # ====================== CHECK LAST LINE ====================== |
There was a problem hiding this comment.
| # ====================== CHECK LAST LINE ====================== | |
| # ====================== CHECK WE CAPTURED SOME OUTPUT ====================== |
| print(f"Error reading output file: {e}") | ||
|
|
||
| print("="*60 + "\n") | ||
| try: |
There was a problem hiding this comment.
| try: | |
| # ====================== CHECK LAST LINE ====================== | |
| try: |
|
|
||
| print("="*60 + "\n") | ||
| try: | ||
| with open(outfile, "r", encoding="utf-8", errors="ignore") as f: |
There was a problem hiding this comment.
No ned to open outfile as second time - you could just look at the last line of captured_content ?
| if attempted == 0: | ||
| print("No ELFs were found to test.") | ||
| sys.exit(0) | ||
|
|
||
| if succeeded == attempted: | ||
| print("All tests passed!") | ||
| sys.exit(0) | ||
| else: | ||
| print("Some tests failed.") | ||
| sys.exit(1) |
There was a problem hiding this comment.
I guess this could be shortened to:
| if attempted == 0: | |
| print("No ELFs were found to test.") | |
| sys.exit(0) | |
| if succeeded == attempted: | |
| print("All tests passed!") | |
| sys.exit(0) | |
| else: | |
| print("Some tests failed.") | |
| sys.exit(1) | |
| if attempted == 0: | |
| print("No ELFs were found to test.") | |
| elif succeeded == attempted: | |
| print("All tests passed!") | |
| else: | |
| print("Some tests failed.") | |
| sys.exit(1) |
No description provided.