diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3b5e964..0f3e140 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,7 @@ test_harness: stage: test script: - echo "Starting tests" - - .util/run_tests.sh -i $CLIENT_CONTAINER_GITSHA_IMAGE -d docker -D + - .util/run_tests.sh -i $CLIENT_CONTAINER_GITSHA_IMAGE --docker -D build_opengl: stage: build diff --git a/.mod_env.json b/.mod_env.json index deac0eb..fe23d22 100644 --- a/.mod_env.json +++ b/.mod_env.json @@ -7,6 +7,6 @@ "strip":1 } ], - "minetest-add-conf": "", + "minetest_add_conf": "", "client_nb": 1 } diff --git a/README.md b/README.md index 041256e..80c2f9e 100644 --- a/README.md +++ b/README.md @@ -22,24 +22,32 @@ This mod's goal is to provide a test framework for implementing tests for minete 1. Declare `test_harness` as an optional dependencies for your mod 2. copy the `.util` folder in your project -3. copy the `.util/.mod_env.tmpl` to `.mod_env` at the root of your folder. +3. copy the `.util/.mod_env.json.tmpl` to `.mod_env.json` at the root of your folder. 4. adapt its content. Do not remove the test_harness dependency definition. -5. if necessary, customize the `.util/Dockerfile` to adapt the `/etc/minetest/minetest.conf.base` file to list the mods you want to test (`test_harness_mods`), and to adjust the server configuration to your project test settings. -6. In your source files (in the `init.lua` for example) add the following lines (or equivalent) +5. The list of mods to test can be set in the `additional_mods` key. This list will be added to `current_mod`, if you add some mods, the list must start with a comma. +6. customize the minetest server configuration by adding configuration values in the `minetest_add_conf` value. This must be a single string, with line returns if necessary. +7. if necessary, customize the `.util/Dockerfile` if the previous means are not sufficients. +8. In your source files (in the `init.lua` for example) add the following lines (or equivalent) + ```lua if minetest.settings:get_bool("test_harness_run_tests", false) then - dofile(minetest.get_modpath("my_mod").. "/test/init.lua") + dofile(minetest.get_modpath("my_mod").. "/test/init.lua") end ``` -7. In your test file(s), get an instance of the method allowing the registration of your tests: + +9. In your test file(s), get an instance of the method allowing the registration of your tests: + ```lua local register_test = test_harness.get_test_registrator("my_mod", my_mod.version_string) ``` -8. Register the test by calling `register_test` -9. Run the test by lauching the `run_tests.sh` script. For example with Podman + +10. Register the test by calling `register_test` +11. Run the test by lauching the `run_tests.sh` script. For example with Podman + ```shell $ .util/run_tests.sh --podman -c 1 ``` + See the available options with `.util/run_tests.sh --help` ## Sources