mirror of https://github.com/commaai/tinygrad.git
run unit tests separate from others (and only once) (#6020)
* run unit tests separate from others * ignore unit tests elsewhere
This commit is contained in:
parent
8302dd6ea4
commit
cfb04c67d1
|
@ -107,6 +107,8 @@ jobs:
|
|||
run: awk '/```python/{flag=1;next}/```/{flag=0}flag' docs/quickstart.md > quickstart.py && PYTHONPATH=. python quickstart.py
|
||||
- name: Test README
|
||||
run: awk '/```python/{flag=1;next}/```/{flag=0}flag' README.md > README.py && PYTHONPATH=. python README.py
|
||||
- name: Run unit tests
|
||||
run: PYTHONPATH="." python -m pytest -n=auto test/unit/
|
||||
- name: Fuzz Test symbolic
|
||||
run: python test/external/fuzz_symbolic.py
|
||||
- name: Fuzz Test shapetracker
|
||||
|
@ -305,7 +307,7 @@ jobs:
|
|||
METAL=1 python -c "from tinygrad import Device; assert Device.DEFAULT == 'METAL', Device.DEFAULT"
|
||||
METAL=1 DEBUG=4 FORWARD_ONLY=1 python3 test/test_ops.py TestOps.test_add
|
||||
- name: Run metal test
|
||||
run: JIT=2 METAL=1 python -m pytest -n=auto test/ --ignore=test/external --ignore=test/models --durations=20
|
||||
run: JIT=2 METAL=1 python -m pytest -n=auto test/ --ignore=test/external --ignore=test/models --ignore=test/unit --durations=20
|
||||
- name: Run real world test
|
||||
run: JIT=2 METAL=1 python -m pytest -n=auto test/models/test_real_world.py --durations=20
|
||||
- name: Run ONNX
|
||||
|
@ -498,7 +500,7 @@ jobs:
|
|||
diff /tmp/io_uring.py.bak tinygrad/runtime/autogen/io_uring.py
|
||||
- name: Run pytest (not cuda or amd)
|
||||
if: matrix.backend!='ptx' && matrix.backend!='triton' && matrix.backend != 'amd' && matrix.backend != 'nv'
|
||||
run: python -m pytest -n=auto test/ --durations=20
|
||||
run: python -m pytest -n=auto test/ --ignore=test/unit --durations=20
|
||||
# - name: Run test_ops with FUZZ_UOPS=1
|
||||
# if: matrix.backend!='cuda' && matrix.backend!='ptx' && matrix.backend!='triton' && matrix.backend != 'amd' && matrix.backend != 'nv'
|
||||
# run: FUZZ_UOPS=1 python -m pytest -n=auto test/test_ops.py --durations=20
|
||||
|
@ -507,7 +509,7 @@ jobs:
|
|||
run: python -m pytest -n=auto test/external/external_test_onnx_backend.py --durations=20
|
||||
- name: Run pytest (cuda)
|
||||
if: matrix.backend=='ptx'||matrix.backend=='triton'||matrix.backend=='nv'
|
||||
run: python -m pytest -n=auto test/ -k 'not (half or test_efficientnet_safetensors)' --ignore=test/external --ignore=test/models --ignore test/test_gc.py --durations=20
|
||||
run: python -m pytest -n=auto test/ -k 'not (half or test_efficientnet_safetensors)' --ignore=test/external --ignore=test/models --ignore=test/unit --ignore test/test_gc.py --durations=20
|
||||
- name: Run pytest (amd)
|
||||
if: matrix.backend=='amd'
|
||||
run: python -m pytest -n=auto test/test_ops.py test/test_dtype.py test/test_dtype_alu.py test/test_linearizer.py test/test_randomness.py test/imported/test_indexing.py test/test_hcq.py --durations=20
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
const puppeteer = require('puppeteer');
|
||||
const { spawn } = require('child_process');
|
||||
const res = spawn("python", ["-m", "http.server", "8000"], { shell: true });
|
||||
|
||||
async function timeout(time) {
|
||||
return new Promise((resolve) => setTimeout(resolve, time));
|
||||
}
|
||||
|
||||
function cleanup(err) {
|
||||
console.log("cleaning up");
|
||||
res.kill();
|
||||
if (err != null) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
async function waitForText(selector, text) {
|
||||
let n = 0;
|
||||
let ready = false;
|
||||
while (n < 30) {
|
||||
const res = await (await selector.getProperty("textContent")).jsonValue();
|
||||
console.log(`waiting for text ${text} got ${res}`);
|
||||
if(res == text) {
|
||||
ready = true;
|
||||
break
|
||||
}
|
||||
await timeout(1000);
|
||||
n += 1
|
||||
}
|
||||
return ready;
|
||||
}
|
||||
|
||||
async function runTest() {
|
||||
const browser = await puppeteer.launch({ headless: false, args: ["--enable-unsafe-webgpu"] });
|
||||
const page = await browser.newPage();
|
||||
|
||||
page.on("console", message => console.log(`message from console ${message.text()}`))
|
||||
.on("pageerror", ({ message }) => console.log(`error from page ${message}`));
|
||||
|
||||
const res = await page.goto("http://localhost:8000/examples/index.html");
|
||||
if (res.status() !== 200) throw new Error("Failed to load page");
|
||||
|
||||
const textSelector = await page.waitForSelector("#result");
|
||||
const buttonSelector = await page.waitForSelector("input[type=button]");
|
||||
const ready = await waitForText(textSelector, "ready");
|
||||
if (!ready) throw new Error("Failed to load page");
|
||||
|
||||
await buttonSelector.evaluate(e => e.click());
|
||||
const done = await waitForText(textSelector, "hen");
|
||||
if (!done) throw new Error("failed to get hen");
|
||||
|
||||
cleanup(null);
|
||||
}
|
||||
|
||||
runTest().catch(err => cleanup(err));
|
Loading…
Reference in New Issue