-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[RFC] Proposal for integrated test suite in Alire #1831
Comments
Thanks @AldanTanneo , The thing I liked the most when we first discussed your idea is that it's both extremely simple to start writing tests, but also quite open in terms of how you want to implement the tests. You can just use |
I agree on the alr test renaming. When we have both Ada unit tests and external tools to run, does it mean that we would have to write a single top "run.sh"? And how will it cope with the Ada part? Also, it may be interesting at initialization to test if there is a classical Makefile with a "check" target in the root crate's dir, and to propose it in the runner list... |
That's an interesting idea! The proposed Alternatively, one could use the
I'm a bit reluctant to add a dependency on |
Wrt. to renaming If you define test actions (https://github.com/alire-project/alire/blob/master/doc/catalog-format-spec.md#release-information), they will be run in order instead of the default build. This is already used in our index submissions. If necessary, we could redefine the fields in the test action (or add e.g. a timeout); or we could move test actions to their own In my unstated plans about testing improvements, when a new crate is initialized, a default test action should exist. This way users know that a modicum of testing is happening, and that they can add likewise other, more sophisticated tests. This default test action, at least before we have something more fancy like this proposal, should run a nested crate, that should also exist by default (no need to That would be superseded by a more test-oriented structure like the one proposed here, of course. This was the bare minimum I wanted to have in the short term. I'm currently experimenting with templating so maintaining and improving generation of crates is simpler; that will certainly help with this proposal too. |
Thanks for the detailed explanations on the current behaviour of As a newcomer to the Ada ecosystem, my experience is that test actions are confusing and there is no clear, simple way to do testing in Alire. I feel like a minimal default test runner helps to alleviate that issue. And indeed, a templated crate is what I intended for the |
Yes, I agree that having something like this is necessary. And you're right that at the moment there's nothing about testing in the manifest, and even if you find the guidelines in the documentation, it is just 'have a nested crate do the testing'. |
I'm a bit worried this would be a breaking change to the tests I already have in AdaCL as I don't use a generated tests but wrote my tests with AUnit by hand. Note that currently all applications in |
If this proposal goes forward, the goal is to make it very configurable. There would be a breaking change in the manifest file, if we go with the Alternatively, there could be no default behaviour in an empty manifest, but crate creation could set up a default I do wish there was some kind of manifest versioning, so that breaks could be avoided altogether between alire versions. |
Manifests follow index syntax, so they're versioned in a way. But, when we introduce breaking or incremental changes in the index/manifest syntax, this is known by the next Running with As for local manifests, I see value in having their explicit version in them; this would allow explicit identification of mismatches and in a way would help to identify old manifests. Expecting that
Actually this was intended as a temporary workaround for a while since at the time TL;DR: the proposal here is an improvement over our current situation, but existing test actions already allow what is proposed here if we generated the test crate during |
The goal is to provide a very simple test functionality in Alire, explicitly targeted towards small community crates. That means: very little setup, NO extra dependencies.
The default test runner would be easily replaceable, however, to allow bigger projects to use more complex test drivers.
CLI changes
alr test
subcommand, rename italr index-test
(breaking change; Alire 3.0?)alr test
command for running actual crate testsalr test --generate
: create basic file structure for tests with default test runner. This is run only once, when setting up the project.Manifest changes
[tests]
Default keys:
tests
sub-folder'salire.toml
, if it exists (recommended). This opens the possibility to provide more advanced test runners in the alire index.Default test runner
Goals: be extremely simple, but also very easy to replace
Default dir structure (
tests
is a sub-folder of the main crate folder):All tests are sub-procedures of a main
Tests
package, optionally with test helper code located incommon
. Each test file contains a single procedure that will be run in its own process (potentially in parallel - leverage process isolation).Default
alire.toml
andtests.gpr
are created byalr test --generate
; the GPR file imports a config file specifying theMain
targets, that is recreated when the tests to compile and run change (ie. from test filtering or from adding/removing tests). When runningalr test
, those main files are compiled and executed.Sub-crate's
alire.toml
can contain test only dependencies, environment overrides, etc.A test is considered PASSING when its exit code is 0, FAILING otherwise. This catches assertion fails (if they return non-zero exit codes, like in AUnit) and unhandled exceptions. (Maybe provide default
Assert
functions that exit with a non-zero code? or simply reuse AUnit's Assertions -> leave choice to the user withalire.toml
test dependencies)Other possibilities:
[tests]
section.adb
file prelude in TOML format specifying custom test settings? (goes against simplicity goal? [TO DISCUSS])The text was updated successfully, but these errors were encountered: