Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

Repository files navigation

cmake_tests

Regression tests for the derammo/cmake submodule. Lives outside the cmake submodule and outside cmake-example so that:

  • consumers of the cmake submodule don't get test files in their tree
  • the test harness is independent of any particular example project
  • the submodule pin can be bumped here independently to test changes

Requirements

Only POSIX tools: sh, make, sed, find, grep. No C/C++ compiler needed — these tests only exercise the text-generation parts of cmake/setup.make.

Running

After cloning:

git submodule update --init
make test

Each tests/test_*.sh file is a standalone script and can be run directly:

sh tests/test_root_sed_g_flag.sh

What is tested

Each test creates an isolated sandbox under $TMPDIR, symlinks the cmake submodule into it, runs make -f .../cmake/setup.make <target>, and asserts on the generated files.

Test Target in setup.make Bug it covers
test_root_sed_g_flag.sh root sed without /g at setup.make:58
test_library_local_sources.sh library > vs >> in root-source loop at setup.make:23-25
test_executable_local_sources.sh executable > vs >> in root-source loop at setup.make:46-48
test_executable_private_sources.sh executable > vs >> in src/ loop at setup.make:49-51

Examples

examples/ is one cmake project (examples/CMakeLists.txt, built with make from that directory) that exercises the cmake submodule pinned at examples/cmake against both languages:

Tree Generated by Contents
examples/cpp setup.make library / executable mylib (fixed source list), autolib (globbed sources), hello (executable), each library with a gtest/ suite
examples/typescript setup.make workspaces / typescript / npm an npm workspace root with mylib (TypeScript, vitest), jestlib (TypeScript, jest), tarball (TypeScript, vitest, npm pack tarball on build), and plain (no TypeScript, node built-in test runner)
examples/java hand written a maven hello world with a JUnit test; pom.xml is generated from pom.xml.in, and the root CMakeLists.txt points JDK at the system javac

Each npm package's package.json is generated from its _package_template.json at configure time; the packages differ only in which _package_template_*.json mixins they extend. make test from examples/ runs every registered test through ctest: the gtest suites, one npm run test per package, and mvn test; ctest --print-labels in the build directory lists the providers and make test-<label> runs one of them.

Updating the pin

When a fix to the cmake submodule should be tested:

cd cmake
git fetch
git checkout <fixed commit>
cd ..
git add cmake
git commit -m "bump cmake to <sha>"
make test

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages