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

Fix silent test failures enforcing min shunit2 version #40

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

arthurbdiniz
Copy link
Contributor

This pull request addresses silent test failures due to an outdated version of shunit2. It introduces a compatibility check to ensure that shunit2 version 2.1.8 or higher is installed before running the tests.

If the required version is not met, an informative error message is displayed, guiding users on how to resolve the issue.

A new script file compatibility.sh has been added to perform this check, and tests.sh now calls this script at the start to enforce the minimum version requirement.

Validation

  1. Environment running version 2.1.6
podman run -v `pwd`:/home -w /home -it ubuntu:jammy bash
apt update && apt install -y curl shunit2
./tests/tests.sh

Error: shunit2 version 2.1.8 or higher is required.
Please install a compatible version of shunit2.
  1. Environment running version 2.1.8
./tests/tests.sh 
testUsage
testNoOptionError
testInvalidOptionError
testParallelIfMoreThanOneUrl
testEncodingWhitespace
testDoubleDash
testCurlOptions
testNextAmount
testUrlStartingWithDash
testOutputFileName
testOutputFileNameRepeatedOption
testUrlDefaultName
testUrlDefaultNameTrailingSlash
testUrlDecodingWhitespaces
testUrlDecodingWhitespacesTwoFiles
testUrlDecodingDisabled
testUrlDecodingWhitespacesQueryString
testUrlDecodingWhitespacesTrailingSlash
testUrlDecodingNonLatinLanguages

Ran 19 tests.

OK

Closes: #39

@arthurbdiniz arthurbdiniz force-pushed the fix-silent-test-failures branch from 2e55bd7 to 4108bd1 Compare December 9, 2024 23:39
tests/tests.sh Outdated
check_shunit2_compatibility() {
output=$(sh ./tests/compatibility.sh 2>/dev/null)

if ! echo "${output}" | grep -q "OK"; then
Copy link
Member

@samueloph samueloph Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed in person, you can simplify all of this by directly calling assertContains in the if statement and branching on the result of that.

This might expose the issue with macos, which is currently failing for an unknown reason.

@arthurbdiniz arthurbdiniz force-pushed the fix-silent-test-failures branch from 4108bd1 to b56782d Compare December 19, 2024 22:56
@samueloph samueloph merged commit 52958b6 into curl:main Dec 19, 2024
5 checks passed
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.

Fix silent test failures by enforcing minimum shunit2 version
2 participants