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

Just test PoC #18273

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Just test PoC #18273

wants to merge 9 commits into from

Conversation

redsun82
Copy link
Contributor

@redsun82 redsun82 commented Dec 12, 2024

This is a rough PoC showcasing just as a builder/test runner.

After installing just you can (in this PoC <language> can only be rust):

  • just install <language> to install a language pack in-tree <language> can be omitted if running from inside its directory.
  • just build <language> will build target/intree/codeql-<language> from the internal repository, if available, otherwise it will fall back to install.
  • just test TESTS... FLAGS... will run the provided tests, if they are of the same kind (integration or QL tests), passing FLAGS to the runner (flags with arguments are required to be passed as --flag=value or -fvalue, as one string). For QL tests the appropriate build <language> is run. Notably, for QL tests this command works also if using codeql standalone from the internal repository (using install and codeql from PATH). If running from within a test directory, TESTS can be omitted and defaults to all tests in the current directory. Even the test recipe can be omitted, as it's the default.
  • rust is a just module, so you can also run just rust ... with some other goodies
  • b, i, t aliases

Examples:

just  # <- prints available recipes, could be made to do fuzzy selection
just install rust
(cd rust; just install)
(cd rust; just generate)
(cd rust; just)  # <- defaults to codegen + install
just rust  # <- same as above
just build rust  # or just rust build
(cd rust; just build)
just test rust/ql/test/extractor-tests/{File,utf8}
just test rust/ql/integration-tests/hello-*
(cd rust/ql/test/extractor-tests/File; just test)
(cd rust/ql/test/extractor-tests/File; just)  # <- defaults to test
(cd rust/ql/integration-tests/hello-project; just test)
(cd rust/ql/integration-tests/hello-project; just)  # <- defaults to test
just rust language-tests  # <- run all rust language tests
just rust integration-tests  # <- run all rust integration tests

This is a rough PoC showcasing [just](https://github.com/casey/just)
as a builder/test runner.

After installing `just` you can (in this PoC <language> can only be
`rust`):
* `just install <language>` to install a language pack in-tree
  `<language>` can be omitted if running from inside its directory.
* `just build <language>` will build `target/intree/codeql-<language>`
  from the internal repository, if available, otherwise it will fall
  back to `install`.
* `just test TESTS... FLAGS...` will run the provided tests, if they
  are of the same kind (integration or QL tests), passing FLAGS to
  the runner. For QL tests the appropriate `build <language>` is run.
  Notably, for QL tests this command works also if using `codeql`
  standalone from the internal repository (using `install` and `codeql`
  from `PATH`). If running from within a test directory, `TESTS` can
  be omitted and defaults to all tests in the current directory.
@github-actions github-actions bot added the Rust Pull requests that update Rust code label Dec 12, 2024
@github-actions github-actions bot added the C++ label Dec 12, 2024
Paolo Tranquilli and others added 4 commits December 12, 2024 17:10
It was slightly more difficult than I thought, because of some
limitations of just:
* the variadic args story is not super solid when passing them around,
  because just only uses string values internally. There is a plan to
  switch that to string lists though, which would make this easier.
* variables defined on the command line do not cross module boundaries,
  so `just print_test_roots=true rust integration-tests` cannot work.

In the end, this works:

```bash
 # runs the tests
 just rust integration-tests
 # only prints roots
 JUST_PRINT_TEST_ROOTS=true just rust integration-tests
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants