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

Add run-test.sh script in the tools folder for automating library testing and building #2136

Open
paolodelia99 opened this issue Jan 11, 2025 · 4 comments

Comments

@paolodelia99
Copy link

Motivation

After building and testing new features implemented using CMake as a meta-build system, I noticed that the commands for building and testing the library could be streamlined into scripts. To simplify and automate this process, I propose adding a new script, run-test.sh, under the tools folder. This script would facilitate testing new features and improve the workflow for contributors.


Proposal

To achieve the goal of automated testing and building, I propose adding the following scripts:

  1. build-with-cmake.sh

    • This script will be responsible for building the project using CMake.
    • It will accept parameters to customize the build process, such as:
      • CMake presets.
      • Additional CMake parameters for flexibility.
    • The script will also validate the existence of necessary dependencies before initiating the build process.
  2. run-test.sh

    • This script will automate the execution of tests for the library.
    • If the library has not been built yet, it will leverage the build-with-cmake.sh script to ensure the project is built before testing.
    • It will support parameters to:
      • Run specific test suites.
      • Pass specific arguments to the testing framework.
    • Provide clear and actionable logs for debugging failed tests.

Optional Extensions

  1. Cross-platform Support

    • Include equivalent scripts for Windows:
      • PowerShell Script: run-test.ps1 and build-with-cmake.ps1
      • Batch Script: run-test.bat and build-with-cmake.bat
    • These scripts will mirror the functionality of their Bash counterparts.
  2. Documentation Updates

    • Add instructions for running the tests using the newly added scripts.
    • Provide a section in the documentation to explain the expected test outputs and logs.

Implementation Offer

I am happy to implement these scripts and submit a pull request if this idea is considered useful for the project. I believe these scripts will enhance developer productivity and help maintain a more robust testing workflow.

Let me know your thoughts, and I’d be happy to proceed with this!

Copy link

boring-cyborg bot commented Jan 11, 2025

Thanks for posting! It might take a while before we look at your issue, so don't worry if there seems to be no feedback. We'll get to it.

@paolodelia99 paolodelia99 changed the title Add run-test.sh script in the tools folder for automating library testing and building Add run-test.sh script in the tools folder for automating library testing and building Jan 11, 2025
@sweemer
Copy link
Contributor

sweemer commented Jan 12, 2025

When you say "automating library testing and building", are you talking about something other than the CI? In case you haven't seen them yet, the commands to automatically build and test the library in the CI are already in the .github/workflows folder.

@paolodelia99
Copy link
Author

Yes, I saw the commands under the .github/workflows folder.
The thing is that when you have to test a new feature of the library locally, instead of running every time the following commands in the build folder

cd ..
make -j6
cd test-suite/
./quantlib-test-suite --log_level=message --run_test=*/SpecificTestSuite/*

you just run a single script from the root folder

source tools/run-tests.sh -o1 option1 ...

It's just to ease the developer job and encapsulate the logic in a shell script.
It's not strictly necessary, but I think it could be useful.
Let me know if you think it's a good idea to do that.

@lballabio
Copy link
Owner

Ciao Paolo, please go ahead if you want to open a PR. It might be useful as an easier way to select a specific test suite.

(This said, you don't need the two cd in your example above:

make -j6
./test-suite/quantlib-test-suite --log_level=message --run_test=*/SpecificTestSuite/*

works without having to change folder)

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

No branches or pull requests

3 participants