maclobdell / mbed-test-runner

Simple Mbed OS test runner for running automated tests on multiple boards and toolchains
0 stars 2 forks source link

Crashes when run arguments are passed to compile operation #7

Open MarceloSalazar opened 6 years ago

MarceloSalazar commented 6 years ago

Using master version: https://github.com/maclobdell/simple_mbed_test_runner/blob/master/run_all_tests.py Modified build options to use -DMBED_TICKELESS

I see (1) a greentea error and (2) runner error: "local variable 'test_results' referenced before assignment"

...
mbedgt: test on hardware with target id: 0240000030514e45004620057bbd002083a1000097969900
mbedgt: test suite 'features-filesystem-littlefs-tests-filesystem_recovery-wear_leveling' ............ OK in 247.49 sec
        test case: 'test wear leveling' .............................................................. OK in 231.68 sec
mbedgt: test case summary: 1 pass, 0 failures
mbedgt: mbed-host-test-runner: started
Exception in thread Thread-41:
Traceback (most recent call last):
  File "c:\python27\lib\threading.py", line 801, in __bootstrap_inner
    self.run()
  File "c:\python27\lib\threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "c:\python27\lib\site-packages\mbed_greentea\mbed_greentea_cli.py", line 489, in run_test_thread
    verbose=verbose)
  File "c:\python27\lib\site-packages\mbed_greentea\mbed_test_api.py", line 318, in run_host_test
    returncode, htrun_output = run_htrun(cmd, verbose)
  File "c:\python27\lib\site-packages\mbed_greentea\mbed_test_api.py", line 134, in run_htrun
    htrun_output += line.decode('utf-8')
  File "c:\python27\lib\encodings\utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xfe in position 27: invalid start byte

mbedgt: could not generate test report
mbedgt: completed in 283.75 sec
mbedgt: exited with code -1000
[mbed] ERROR: "mbedgt" returned error code -1000.
[mbed] ERROR: Command "mbedgt --test-spec C:\mbed\mbed-os-multi\BUILD\tests\K64F\IAR\test_spec.json --report-json C:\mbed\mbed-os-multi\test_output\master\K64F/K64F_iar_74135_results.json" in "C:\mbed
\mbed-os-multi"
---
None
Traceback (most recent call last):
  File "C:\mbed\simple_mbed_test_runner\run_all_tests.py", line 178, in <module>
    main()
  File "C:\mbed\simple_mbed_test_runner\run_all_tests.py", line 122, in main
    generate_scorecard(output_folder_path, target, mbed_ver, other_args)
  File "C:\mbed\simple_mbed_test_runner\run_all_tests.py", line 168, in generate_scorecard
    scorecard_data[toolchain] = test_results
UnboundLocalError: local variable 'test_results' referenced before assignment

@maclobdell

maclobdell commented 6 years ago

how did you pass in the tickless macro?

MarceloSalazar commented 6 years ago

First, I tried passing the -DMBED_TICKELESS to "--other_args" https://github.com/maclobdell/simple_mbed_test_runner/blob/master/run_all_tests.py#L21

It works to compile the tests >mbed test --compile -t IAR -m K64F -DMBED_TICKELESS

But not to run the test:

C:\mbed\mbed-os-multi>mbed test --run -t IAR -m K64F -DMBED_TICKELESS
Usage: mbedgt [options]

mbedgt: error: no such option: -D
[mbed] ERROR: "mbedgt" returned error code 2.
[mbed] ERROR: Command "mbedgt --test-spec C:\mbed\mbed-os-multi\BUILD\tests\K64F\IAR\test_spec.json -DMBED_TICKELESS" in "C:\mbed\mbed-os-multi"

So, later I removed other_args from here: https://github.com/maclobdell/simple_mbed_test_runner/blob/master/run_all_tests.py#L118

MarceloSalazar commented 6 years ago

This should help to fix it properly mbed-os/issues/7482

maclobdell commented 6 years ago

okay to close this ticket? It doesn't seem related to this script.

maclobdell commented 6 years ago

actually, I see what the real problem is. It would be good to have two sets of arguments. One for the compile command. One for the run command. I'll keep this open and implement that later.

MarceloSalazar commented 6 years ago

Please have a look to issue/request I raised to solve this: mbed-os/issues/7482 I think for now you can have two arguments, one for compile and other run.