Skip to content

Respecting --test-spec definition for test command #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2016
Merged

Respecting --test-spec definition for test command #269

merged 1 commit into from
Jul 8, 2016

Conversation

bridadan
Copy link
Contributor

@bridadan bridadan commented Jul 6, 2016

This PR address issue #252.

Previously, the --test-spec option was not being respected. This fixes this behaviour.

Before

Notice how the test spec is not placed in the correct directory nor named correctly.

C:\m\test>mbed test --test-spec=my_test_spec_hurdur.xml -n mbed-os-tests-mbedmicro-rtos-mbed-mutex -v
[mbed] Working path "C:\m\test" (program)
[mbed] Exec "python -u C:\m\test\mbed-os\core\tools\test.py -t GCC_ARM -m K64F --source C:\m\test --build C:\m\test\.build/tests\K64F\GCC_ARM --test-spec C:\m\test\.build/tests\K64F\GCC_ARM\test_spec.json -n mbed-os-tests-mbedmicro-rtos-mbed-mutex -v" in C:\m\test

Build successes:
  * K64F::GCC_ARM::MBED-BUILD
  * K64F::GCC_ARM::MBED-OS-TESTS-MBEDMICRO-RTOS-MBED-MUTEX
[mbed] Exec "mbedgt --test-spec C:\m\test\.build/tests\K64F\GCC_ARM\test_spec.json -n mbed-os-tests-mbedmicro-rtos-mbed-mutex -V" in C:\m\test
mbedgt: test specification file 'C:\m\test\.build/tests\K64F\GCC_ARM\test_spec.json' (specified with --test-spec option)
mbedgt: using 'C:\m\test\.build/tests\K64F\GCC_ARM\test_spec.json' from current directory!
mbedgt: test case results: 1 OK
mbedgt: completed in 23.92 sec

After

The test spec is now placed in the correct directory and named correctly.

C:\m\test>mbed test --test-spec=my_test_spec_hurdur.xml -n mbed-os-tests-mbedmicro-rtos-mbed-mutex -v
[mbed] Working path "C:\m\test" (program)
[mbed] Exec "python -u C:\m\test\mbed-os\core\tools\test.py -t GCC_ARM -m K64F --source C:\m\test --build C:\m\test\.build/tests\K64F\GCC_ARM --test-spec my_test_spec_hurdur.xml -n mbed-os-tests-mbedmicro-rtos-mbed-mutex -v" in C:\m\test

Build successes:
  * K64F::GCC_ARM::MBED-BUILD
  * K64F::GCC_ARM::MBED-OS-TESTS-MBEDMICRO-RTOS-MBED-MUTEX
[mbed] Exec "mbedgt --test-spec my_test_spec_hurdur.xml -n mbed-os-tests-mbedmicro-rtos-mbed-mutex -V" in C:\m\test
mbedgt: test specification file 'my_test_spec_hurdur.xml' (specified with --test-spec option)
mbedgt: using 'my_test_spec_hurdur.xml' from current directory!
mbedgt: test case results: 1 OK
mbedgt: completed in 22.63 sec

Test spec placed in child directory

The test spec is placed in a child directory here.

C:\m\test>mbed test --test-spec=projectfiles/my_test_spec_hurdur.xml -n mbed-os-tests-mbedmicro-rtos-mbed-queue -v
[mbed] Working path "C:\m\test" (program)
[mbed] Exec "python -u C:\m\test\mbed-os\core\tools\test.py -t GCC_ARM -m K64F --source C:\m\test --build C:\m\test\.build/tests\K64F\GCC_ARM --test-spec projectfiles\my_test_spec_hurdur.xml -n mbed-os-tests-mbedmicro-rtos-mbed-queue -v" in C:\m\test

Build successes:
  * K64F::GCC_ARM::MBED-BUILD
  * K64F::GCC_ARM::MBED-OS-TESTS-MBEDMICRO-RTOS-MBED-QUEUE
[mbed] Exec "mbedgt --test-spec projectfiles\my_test_spec_hurdur.xml -n mbed-os-tests-mbedmicro-rtos-mbed-queue -V" in C:\m\test
mbedgt: test specification file 'projectfiles\my_test_spec_hurdur.xml' (specified with --test-spec option)
mbedgt: using 'projectfiles\my_test_spec_hurdur.xml' from current directory!
mbedgt: test case results: 1 OK
mbedgt: completed in 13.99 sec

Test spec placed relative to current directory (not project root)

If mbed test is executed from a directory other than the project root, the destination of the test spec file is relative to this directory, not the project root.

C:\m\test\projectfiles>mbed test --test-spec=my_test_spec_hurdur.xml -n mbed-os-tests-mbedmicro-rtos-mbed-mutex -v
[mbed] Working path "C:\m\test\projectfiles" (program)
[mbed] Exec "python -u C:\m\test\mbed-os\core\tools\test.py -t GCC_ARM -m K64F --source C:\m\test --build C:\m\test\.build/tests\K64F\GCC_ARM --test-spec projectfiles\my_test_spec_hurdur.xml -n mbed-os-tests-mbedmicro-rtos-mbed-mutex -v" in C:\m\test
Build successes:
  * K64F::GCC_ARM::MBED-BUILD
  * K64F::GCC_ARM::MBED-OS-TESTS-MBEDMICRO-RTOS-MBED-MUTEX
[mbed] Exec "mbedgt --test-spec projectfiles\my_test_spec_hurdur.xml -n mbed-os-tests-mbedmicro-rtos-mbed-mutex -V" in C:\m\test
mbedgt: test specification file 'projectfiles\my_test_spec_hurdur.xml' (specified with --test-spec option)
mbedgt: using 'projectfiles\my_test_spec_hurdur.xml' from current directory!
mbedgt: test case results: 1 OK
mbedgt: completed in 22.86 sec

Please review @screamerbg
FYI @mazimkhan

@screamerbg
Copy link
Contributor

LGTM

@screamerbg
Copy link
Contributor

@mazimkhan can you confirm that this solves the issue?

@mazimkhan
Copy link

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants