Skip to content

Conversation

@cwalther
Copy link

@cwalther cwalther commented Nov 25, 2025

This changes the developer experience (but not the user experience)

The following changes are proposed:

  • Lift cmake_minimum_required of test cases to 3.5.0
  • Skip server mode tests on CMake >= 3.20
  • Fix sysroot access test
  • Clarify that fakebin must be built before running tests

(More details in the individual commit messages.)

The purpose of this change

Make it easier for a new developer of CMake Tools to run tests.

Other Notes/Information

I was working on a new feature for CMake Tools and, being new to the project, was having some trouble running the tests. After some investigation, it all came down to two hurdles:

  1. It is not obvious that the tests are intended to be run with a specific old version of CMake (3.18).
  2. It is not obvious that before running tests one needs to build the executables in test/fakebin/ using the test/fakeOutputGenerator/ project.

To fix 1., instead of just writing instructions to install CMake 3.18, I decided to make the tests work with the current version 4.2, because the feature I am working on requires CMake 4.3 (not released yet) and I will want to test with that too. The changes required for that turned out to be relatively minor, and are contained in the first three two of the attached commits.

To fix 2., I made the tests that without fakebin executables would fail in obscure ways, instead fail with a clear message telling the user how to build the missing executables. This is the last commit.

Together, these changes allow me to successfully run all tests (yarn smokeTests, unitTests, integrationTests, endToEndTestsSuccessfulBuild, endToEndTestsSingleRoot, endToEndTestsMultiRoot, backendTests) with both CMake 4.2.0 and 3.18.6 on my Ubuntu 20.04 system.

Would these changes be welcome in the project? Or would you prefer other ways to mitigate these hurdles?

Since these are not user-visible changes, I did not add an entry to CHANGELOG.md. Should I?

@cwalther
Copy link
Author

@microsoft-github-policy-service agree company="Indel AG"

@cwalther
Copy link
Author

I had forgotten to run Format Document again on modified TypeScript files. Fixed in this force push.

Server Mode was removed in favor of the File API in CMake 3.20, so skip the
respective tests when it is not supported. Whether server mode is supported
was tracked already, but only with a lower version bound. Availability of
server mode is explicitly named in the `-E capabilities` response, so
additionally take that into account, effectively adding an upper bound.
Skip configure-time compiler checks when passing a fake sysroot to the
compiler, they would fail because it is unable to link an executable that
way.

I am not sure under what circumstances this has ever worked.
Make the tests that rely on executables in test/fakebin/ check whether they
exist, and if not give a helpful error message, instead of failing in
unclear ways when they find things in the system $PATH instead.

Add a command `yarn pretest-buildfakebin` that documents how to build these
executables, which was otherwise only documented in
.github/workflows/ci-main*.yml and .vscode/settings.json.
@cwalther
Copy link
Author

Rebased on main to fix merge conflicts: Remove the first commit because equivalent changes have in the meantime been made as part of #4633. No other changes required.

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.

1 participant