Skip to content
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

[Review wanted] Async greentea-client support #149

Closed
wants to merge 37 commits into from
Closed

[Review wanted] Async greentea-client support #149

wants to merge 37 commits into from

Conversation

PrzemekWirkus
Copy link
Contributor

Description

Changes related to async feature bundle:

  • test_env macros simplified.
  • Added custom lexer/parser for KiVi (key-value) protocol, see: {{key;value}}.
    • Used to capture master (host) responses or protocol flow (e.g. handshake is started by master/host).
  • Added handshake: sync support.
  • Added slave side API to send KiVi messages to master (host).
  • Ported most of the tests:
    • timers, tickers, rtc, echo etc.

Corresponding changes

Corresponding changes in mbedhtrun are here: ARMmbed/htrun#65
Note that for now Greentea doesn't support new mbedhtrun scheme but I will add it.

Key-value protocol (KiVi)

  • Format {{KEY;VALUE}}}.
  • Master-slave mode where host is master and DUT is slave.
  • Transport protocol KEYs in use:
    • sync - handshake, sync event.
    • end - end of test suite execution event.
    • exit - last event from DUT (Between end and exit LCOV events may appear).
    • coverage_start - LCOV events.
    • testcase_start & testcase_finish - test case mark events.

New test_env implementation

New macros

Note: This will be in the future extracted to separate module e.g. greentea-client. C++ Wrapper will be added.

Naming convention

  • test suite - a binary containing test cases we execute on hardware.
  • test case - equivalent of a test case in utest.
    • New macros introduced for test case mark:

DUT test case idiom

void app_start(int, char*[]) {
    bool result = true;
    GREENTEA_START();
    GREENTEA_SETUP(15, "wait_us_auto");

    // Test suite body

    GREENTEA_TCASE_START("MINAR001");
    // MINAR0001 test case body
    int success = 0;  // success == 0
    GREENTEA_TCASE_FINISH("MINAR001", success);

    GREENTEA_TSUITE_RESULT(result);
}

TODO

  • Add TIMEOUT support
  • Bindings with Greentea (lcvo, test cases, and --digest support)
  • Port more tests like: serial_interrupt, detect etc.
  • Port socket-test (e.g. tcp-client) with new async APIs.

Example implementation

@PrzemekWirkus PrzemekWirkus changed the title Async greentea-client support [Review wanted] Async greentea-client support Feb 2, 2016
@0xc0170
Copy link
Contributor

0xc0170 commented Feb 5, 2016

Note: This will be in the future extracted to separate module e.g. greentea-client. C++ Wrapper will be added.

Before we go further with a review, are these changes considered to be breaking? I am asking mainly because the test env files should be moved as a note quoted above.

Looking at the changes they are breaking. We should sync about this, how to proceed (move test files plus this update).

@autopulated
Copy link
Contributor

How does this relate to https://github.com/ARMmbed/utest?

@niklarm
Copy link
Contributor

niklarm commented Feb 5, 2016

The default greentea handlers in utest will need to be updated to reflect the changes here.
All written test should then just work fine.

#endif
#define GREENTEA_TSUITE_RESULT(RESULT) notify_completion(RESULT);
#define GREENTEA_TCASE_START(TESTCASE_UD) notify_testcase_start(TESTCASE_UD);
#define GREENTEA_TCASE_FINISH(TESTCASE_UD,SUCCESS) notify_testcase_finish(TESTCASE_UD,SUCCESS);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Macros? There are no macros where we're going.
They obscure type information.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, could we please spare the three more letters and call this GREENTEA_TESTCASE_*?

@niklarm
Copy link
Contributor

niklarm commented Feb 5, 2016

Apart from some cosmetic changes, 👍 from me.
The above summary has some mistakes:

  • {{{key;value}}} six braces?
  • GREENTEA_TCASE_START(MINAR001); no strings?

@PrzemekWirkus
Copy link
Contributor Author

@0xc0170

Before we go further with a review, are these changes considered to be breaking? I am asking mainly because the test env files should be moved as a note quoted above.

This is breaking everything, tests in yotta modules and host tests.

DONE: Macros? There are no macros where we're going. They obscure type
      information.
DONE: Also, could we please spare the three more letters and call this
      GREENTEA_TESTCASE_*?
DONE: Maybe we can make this more robust, by placing this in a while loop until
      _key is equal to __sync?
Prevented tok_eof expectation after tok_close received
utest will do test case reporting heavy lifting
@PrzemekWirkus
Copy link
Contributor Author

I'm closing this PR because it is obsolete and was used to present Async feature idea.
Please refer to ARMmbed/greentea#78 for more details.

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.

4 participants