Can Twister be run without a full Zephyr source tree on the execution machine?

Hi,

I’m working on a distributed testing pipeline where tests are built on one machine,
but executed on a separate, lightweight container that does not contain the full
Zephyr source tree.

I’d like to understand whether Twister can be run without requiring the complete
Zephyr OS environment on the execution side.

Specifically:

  • Does Twister fundamentally depend on having the full Zephyr source tree available
    at execution time?
  • Is there a supported or recommended way to decouple Twister execution from a full
    Zephyr checkout (for example, using only build artifacts or a reduced environment)?

Any guidance, references, or design rationale would be greatly appreciated.

Thanks!

Parents
  • Hi,

    For Twister to function, the Zephyr source tree and environment is required. Twister works as a scanner and scans for board descriptions and test files in Zephyr folders. Twister would not know what to test if the Zephyr tree isn't there. It also compiles tests before running them for which access to Zephyr CMake files and toolchains provided by the Zephyr SDK are required. 

    You cannot "decouple" it exactly but it is possible to make it easier to manage. One way is to use pre-made Docker container which contains the full Zephyr environment. This way you can run Twister inside it. This is to avoid cluttering your machine. While this contains toolchains and dependencies which are needed, you still have to use "west init" and "west update" to create workspace inside the container before you run Twister. 

    Another option is to use integration mode where Twister provides an --integration flag for CI environments. This provides quicker feedback by minimizing the scope of builds and tests. It also works within Zephyr source structure. ( Integration Mode documentation)

    Hope this helps.

    Best Regards,

    Samruddhi

  • Hi Samruddhi,

    Thank you for your detailed explanation—it’s very helpful.

    I have a few follow-up questions:

    1. Is there any external tool outside of Twister that can provide similar functionality—such as filtering tests by tags, flashing, UART parsing, and reporting—without requiring the full Zephyr source tree?

    2. If not, could you explain why such a tool doesn’t exist?

    3. From your experience, how difficult would it be to implement a tool with these capabilities myself?

    thanks!

Reply
  • Hi Samruddhi,

    Thank you for your detailed explanation—it’s very helpful.

    I have a few follow-up questions:

    1. Is there any external tool outside of Twister that can provide similar functionality—such as filtering tests by tags, flashing, UART parsing, and reporting—without requiring the full Zephyr source tree?

    2. If not, could you explain why such a tool doesn’t exist?

    3. From your experience, how difficult would it be to implement a tool with these capabilities myself?

    thanks!

Children
  • Hi,

    1) Currently, there is no external supported tool which is documented that replaces Twister's functionality without requiring the full Zephyr source tree.

    2) Twister is created to perform certain functions like:

    - Going through the repository and YAML files to find tests in the Zephyr tree.

    - It decides which boards to use and how to run tests

    - Integrating with harnesses (pytest etc.) and produce standardized reports. 

    So the docs go by this "Twister + Zephyr source tree" model. They don't mention any alternatives.

    3) If you are thinking of building your own tool, then the replacement would also have to replicate several components such as metadata handling, runners, harness logic and reporting. So you would have to re-implement Twister's functions yourself which can be quite a complex task. 

    Hope this helps.

    Best Regards,

    Samruddhi

Related