Skip to content

Add explicit support for testing: xmake test #3381

@paul-reilly

Description

@paul-reilly

Is your feature request related to a problem? Please describe.

This is related to target name clashes described in #3380 where multiple subdirectories have a tests target.

Describe the solution you'd like

xmake should have the facility to easily compile and execute tests:

xmake test [target dir or more specific target] [options]
  • a new target kind of test would be needed to let xmake know what was a test.

Related to the target clashes described in #3380, when including subdirectories where the author was not aware that defining tests was a going to be a thing in the future, we could have something like :

includes("external/**/xmake.lua", { test_targets = { "tests", "mytests" }})

... which would stop those targets being built as part of a non-test build.

cargo test is highly recommended and since xmake supports languages with integrated testing already:

  • xmake test should also be able to run (e.g.) zig test or cargo test for targets using these languages

For complete testing in C/C++:

  • support running asan/tsan/ubsan builds

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions