A testing library for running language/compiler tests from YAML metadata.
Project description
Compiler Testing Lib
A flexible, multi-language testing framework for compiler and language feature validation. Designed to run language-specific tests defined in YAML files, with support for running tests via Python, Docker, or as a CI/CD step.
Features
- Multi-language support: Organize tests for Python, JavaScript, and more.
- YAML-based test definitions: Centralized, versioned test metadata.
- Pluggable runners: Run tests using Python, Node.js, or any command-line tool.
- Docker integration: Build and run tests in isolated containers, with support for auto-cloning test repos.
- PyPI package: Installable as
compiler-testing-lib. - Submodule example repo: See
compiler-testing-examplefor a ready-to-use test suite.
Directory Structure
compiler-testing-lib/ # Main library package
compiler_testing_lib/
__init__.py
runner.py
languages/ # Test definitions and source files (per language/version)
python/
v1.0/
test001.py
test002.py
test.yaml
setup.py
MANIFEST.in
...
compiler-testing-example/ # Example repo (as a git submodule)
images/ # Docker build and run scripts
python/
Dockerfile
run_in_container.py
run.sh
mount.sh
clean.sh
Installation
As a Python Library
pip install compiler-testing-lib
For Local Development
pip install -e .
Install Example Requirements
pip install -r compiler-testing-example/requirements.txt
Usage
1. Run Tests via Python
from compiler_testing_lib.runner import TestRunner
runner = TestRunner(language='python', version='v1.0', max_errors=3, timeout=10, file_extension='py')
result = runner.run_tests(command_template='python3 main.py')
print(result)
2. Run Tests via Example Scripts
python3 compiler-testing-example/test.sh # Python runner (default)
python3 compiler-testing-example/test.sh js # Node.js runner
3. Run in Docker
Build the image:
cd images
./mount.sh
Run the container (auto-clones the example repo and runs tests):
./run.sh
Docker Image Details
- Installs the latest
compiler-testing-libfrom PyPI. - Accepts
--git_usernameand--git_repositoryto auto-clone a test repo. - Runs all tests and prints results to the terminal.
Adding/Updating Tests
- Place new test files and update
test.yamlin the appropriatelanguages/<lang>/<version>/directory insidecompiler_testing_lib/. - Rebuild and upload the package to PyPI for distribution.
Contributing
- Fork the repo and create a feature branch.
- Add or update tests in
compiler_testing_lib/languages/. - Update
test.yamlas needed. - Run tests locally or in Docker.
- Submit a pull request.
License
MIT
For more examples, see the compiler-testing-example submodule.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file compiler_testing_lib-0.1.9.tar.gz.
File metadata
- Download URL: compiler_testing_lib-0.1.9.tar.gz
- Upload date:
- Size: 28.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdb77ada74803bdf35156aea43a12fd8d5ed0ab7bde116db534d4cb9d78cebaa
|
|
| MD5 |
9917f58270b9380c1a405ceba8b25dda
|
|
| BLAKE2b-256 |
cdaba5cf815e10034487b9850cf756dd014efc9a5e676faaf5a29cb841a88015
|
File details
Details for the file compiler_testing_lib-0.1.9-py3-none-any.whl.
File metadata
- Download URL: compiler_testing_lib-0.1.9-py3-none-any.whl
- Upload date:
- Size: 109.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6deac294d6e5413c82dbbe5e46259d0b72ac094d184cac87d24db7643bc9f7a
|
|
| MD5 |
919d2aab2011d6b4cccb31ba7095a661
|
|
| BLAKE2b-256 |
b0f6fd79908600fdbbb1c144256e7aea6867ec3eb72614bdb71b1a7a24b7c989
|