Skip to content

Conversation

@ianthomas23
Copy link
Member

This extends to wasm tests to include git init (lots of filesystem access) and git clone (https requests from github via a CORS proxy). The tests covered now aretest_clone.py, test_git.py, test_init.py and the new test_fixtures.py which tests the new fixtures and mocks that are defined in conftest_wasm.py to run test code in the browser rather than in python on the local file system.

By default such testing now uses the latest main branch of cockle rather than the latest release. There are two new cmake options:

  • USE_RECIPE_PATCHES: Use patches from emscripten-forge recipe or not, default is ON
  • USE_COCKLE_RELEASE: Use latest cockle release rather than repo main branch, default is OFF

The testing framework now serves it own CORS proxy using cors-anywhere to avoid using a free public CORS proxy which can be rate limited or otherwise restricted or unreliable.

This is now using emscripten 4.x builds. All the important information on how to use this is in the wasm/README.md file and it should be easily runable on any linux or macos system.

Future work in separate PRs:

  • Include testing of more of the test_*.py files. Some of this will hopefully be quite easy, some not.
  • Add the ability to run the wasm tests in CI on demand, certainly not in every PR though.


assert os.path.exists(os.path.join(tmp_path, "xtl"))
assert os.path.exists(os.path.join(tmp_path, "xtl/include"))
assert (tmp_path / "xtl").exists()
Copy link
Member Author

Choose a reason for hiding this comment

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

I've switched from os.path functions to pathlib.Path as the latter are mocked correctly for wasm and I don't want to also mock os.path too.

p_status = subprocess.run(status_cmd, capture_output=True, cwd=tmp_path / "xtl", text=True)
if not GIT2CPP_TEST_WASM:
# TODO: fix this in wasm build
assert p_status.returncode != 0
Copy link
Member Author

Choose a reason for hiding this comment

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

I've added to this test as it was behaving strangely, and it turns out the error code here is wrong in wasm but correct in linux/macos. I've no idea yet about how this could possibly occur!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant