Skip to content

Revise cli tests #365

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

Closed
wants to merge 28 commits into from
Closed

Conversation

rpspringuel
Copy link
Contributor

Here's a sample of how I'm thinking of revising the scripted cli tests. The basic idea is to capture the expected output (either to stdout or stderr or both) and make sure it's correct. Right now I've not expanded the number of tests, but I could see testing the stdout output and the stderr output in separate tests (e.g. stdin_and_stdin.sh would become 2 tests).

Some form of VersionManager.py (from the main repository) will probably need to be added to the repository for this to work (as version number appears in some output, e.g. version.sh).

What do people think about this revision?

davidweichiang and others added 4 commits February 3, 2025 19:11
- change `convert` to `magick` and `compare` to `magick compare`
- change order of arguments to put input file before operations
- in computation of diff, remove "-background white -flatten" but I do not know why
@eschwab
Copy link
Contributor

eschwab commented Feb 10, 2025

Do we need to check for gregorio version?

Or is it good enough to change:

EXPECTEDOUT="% File generated by gregorio 6.0.0
\GregorioTeXAPIVersion{6.0.0}%

to:

EXPECTEDOUT="% File generated by gregorio $gregorio-version
\GregorioTeXAPIVersion{$gregorio-version}%

$gregorio-version would need to be exported in gregorio-test.sh

@rpspringuel
Copy link
Contributor Author

Okay, that should rewrite all the cli tests so that the actual output messages are checked and not the exit code.

Now that I write that, I realize that I should probably "add" tests that test the exit state. Of course, those would simply be the original tests (or at least equivalent to them).

While one could argue that the original tests were based really tests of the exit state, I decided not to rewrite the tests in a way that makes explicit that we are testing the exit state and what we expect the exit state to be.  Since we only use exit states of 0 (success) and 1 (failure) that may seem like overkill, but this leaves open the possibility of us making a more expansive use of exit states in the future.
The error messages for a few tests use the actual name of the invocation rather than just "gregorio" in a few more places than I originally thought.
@rpspringuel
Copy link
Contributor Author

So, that completes the cli tests, but I've been looking at the other scripted tests and am now wondering if I shouldn't do the same thing for them. Any thoughts on this?

@rpspringuel
Copy link
Contributor Author

Can anyone explain the difference between the two kpsewhich tests? bad-response.sh and many-vowel.sh seem to test exactly the same thing as the exported environmental variable doesn't appear to make a difference on my system.

@rpspringuel
Copy link
Contributor Author

Okay, I've figured out what bad-response.sh and many-vowel.sh are supposed to be doing, but I'm not sure they are actually doing it. There's a local kpsewhich script in the test that should return either nothing (bad-response) or the list of dat files in the test folder (many-vowel) instead of what the actual kpsewhich would return (the locations of the various gregorio-vowels.dat files on your system). However, in my testing, it appears that the local script is not used when conducting the test (despite the alteration to PATH that's supposed to ensure that it is). Gregorio seems to be finding the real kpsewhich and using that. (Adding the -v option to the call gets gregorio to print out the vowel files it consulted, and this list corresponds to the ones the actual kpsewhich finds, not the ones our pseudo-kpsewhich does.)

I've double checked that I'm using the gregorio that comes with TeX Live (i.e. one which is compiled with the kpathsea libraries). This may be revealing a problem with our use of the kpathsea libraries. Can anyone confirm that?

@rpspringuel rpspringuel changed the title Start revising cli tests REvise cli tests May 6, 2025
@rpspringuel rpspringuel changed the title REvise cli tests Revise cli tests May 6, 2025
@rpspringuel rpspringuel changed the base branch from develop to ctan May 6, 2025 18:29
@rpspringuel rpspringuel closed this May 6, 2025
@rpspringuel rpspringuel deleted the cli-revisions branch May 6, 2025 18:39
@rpspringuel rpspringuel mentioned this pull request May 6, 2025
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.

3 participants