Disable WASM bindings benchmarks on Github CI
Updated the wasm/README.md to describe how to manually run the benchmark tests. PiperOrigin-RevId: 827881670 Change-Id: I1d524851d9f3f8182ecbfcc649bb9a5a61d716ae
This commit is contained in:
committed by
Copybara-Service
parent
3d59b20b65
commit
2018b8c494
+21
-13
@@ -135,15 +135,32 @@ bounds checking and nice error reporting.
|
|||||||
|
|
||||||
1. **JavaScript API tests.**
|
1. **JavaScript API tests.**
|
||||||
These verify that a wide variety of MuJoCo functions and classes work
|
These verify that a wide variety of MuJoCo functions and classes work
|
||||||
correctly when called from JavaScript. There are also preliminary benchmarks
|
correctly when called from JavaScript. Run the tests as follows:
|
||||||
for JavaScript/C++ shared memory buffers. The enums test is special because
|
|
||||||
it is generated by a Python script. Run the tests as follows:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm run test --prefix ./wasm
|
npm run test --prefix ./wasm
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Bindings generator tests.**
|
> [!NOTE]
|
||||||
|
> The above command runs the [`enums_tests.ts`](tests/enums_tests.ts) file
|
||||||
|
> which checks that all the enums in the API are bound. This test is
|
||||||
|
> auto-generated so if you add/edit an enum to MuJoCo then you will need to
|
||||||
|
> run the following command to re-create the test:
|
||||||
|
>
|
||||||
|
> ```sh
|
||||||
|
> PYTHONPATH=python/mujoco python3 -m wasm.codegen.enums_test_generator
|
||||||
|
> ```
|
||||||
|
|
||||||
|
2. **JavaScript API benchmark tests.**
|
||||||
|
The current benchmark tests check JavaScript/C++ shared memory buffers
|
||||||
|
performance. We will increase the coverage of the benchmarks overtime. Run
|
||||||
|
the benchmarks using this command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run benchmark --prefix ./wasm
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Bindings generator tests.**
|
||||||
These are relevant when developing or extending the bindings. The following
|
These are relevant when developing or extending the bindings. The following
|
||||||
command finds and runs all `test_*.py` or `*_test.py` files in the `wasm`
|
command finds and runs all `test_*.py` or `*_test.py` files in the `wasm`
|
||||||
folder:
|
folder:
|
||||||
@@ -152,15 +169,6 @@ bounds checking and nice error reporting.
|
|||||||
PYTHONPATH=python/mujoco python3 -m pytest ./wasm
|
PYTHONPATH=python/mujoco python3 -m pytest ./wasm
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> If you add/edit an enum in MuJoCo you will need to run the following command
|
|
||||||
> to re-creates the [`enums_tests.ts`](tests/enums_tests.ts) file which checks
|
|
||||||
> that all the enums in the API are bound:
|
|
||||||
>
|
|
||||||
> ```sh
|
|
||||||
> PYTHONPATH=python/mujoco python3 -m wasm.codegen.enums_test_generator
|
|
||||||
> ```
|
|
||||||
|
|
||||||
### Debugging
|
### Debugging
|
||||||
|
|
||||||
We provide a “sandbox” app where you can quickly write code to run in your
|
We provide a “sandbox” app where you can quickly write code to run in your
|
||||||
|
|||||||
+2
-1
@@ -8,7 +8,8 @@
|
|||||||
"test": "tests"
|
"test": "tests"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node --loader ts-node/esm --trace-warnings tests/run-tests.mjs",
|
"test": "node --loader ts-node/esm --trace-warnings tests/run_tests.mjs",
|
||||||
|
"benchmark": "node --loader ts-node/esm --trace-warnings tests/run_benchmarks.mjs",
|
||||||
"dev:sandbox": "vite --config tests/sandbox/vite.sandbox.config.ts",
|
"dev:sandbox": "vite --config tests/sandbox/vite.sandbox.config.ts",
|
||||||
"build:sandbox": "vite build --config tests/sandbox/vite.sandbox.config.ts",
|
"build:sandbox": "vite build --config tests/sandbox/vite.sandbox.config.ts",
|
||||||
"dev:demo": "vite --config demo_app/vite.demo.config.ts",
|
"dev:demo": "vite --config demo_app/vite.demo.config.ts",
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const jasmine = new Jasmine();
|
|||||||
|
|
||||||
jasmine.loadConfig({
|
jasmine.loadConfig({
|
||||||
spec_dir: 'tests',
|
spec_dir: 'tests',
|
||||||
spec_files: ['**/*_test.ts'],
|
spec_files: ['benchmark_test.ts'],
|
||||||
jsLoader: 'import',
|
jsLoader: 'import',
|
||||||
random: false,
|
random: false,
|
||||||
stopSpecOnExpectationFailure: false,
|
stopSpecOnExpectationFailure: false,
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
// Copyright 2025 DeepMind Technologies Limited
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
import Jasmine from 'jasmine';
|
||||||
|
|
||||||
|
const jasmine = new Jasmine();
|
||||||
|
|
||||||
|
jasmine.loadConfig({
|
||||||
|
spec_dir: 'tests',
|
||||||
|
spec_files: ['**/*_test.ts', '!benchmark_test.ts'],
|
||||||
|
jsLoader: 'import',
|
||||||
|
random: false,
|
||||||
|
stopSpecOnExpectationFailure: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
console.log('Starting Jasmine test run...');
|
||||||
|
const result = await jasmine.execute();
|
||||||
|
console.log(`Jasmine test run finished. Status: ${result.overallStatus}`);
|
||||||
|
|
||||||
|
if (result.overallStatus === 'failed') {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Test runner script failed:', error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user