Skip to content

Commit

Permalink
Normalize handling of mocha timeout and default to 5s. #222
Browse files Browse the repository at this point in the history
The mocha timeout code was random throughout all the different tests,
instead move it to the common util file. This means that we can make
all the timeouts the same.
  • Loading branch information
jonahgraham committed Sep 27, 2022
1 parent 36a785a commit 3708cea
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 51 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ jobs:
run: yarn
- name: Build Test Programs
run: make -C src/integration-tests/test-programs
- name: Use special Mocha settings on Windows tests
run: |
Copy -path .mocharc-windows-ci.json -destination .mocharc.json -verbose
- name: Test
run: yarn test-ci
- name: Log file artifacts
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ jobs:
run: yarn
- name: Build Test Programs
run: make -C src/integration-tests/test-programs
- name: Use special Mocha settings on Windows tests
run: |
Copy -path .mocharc-windows-ci.json -destination .mocharc.json -verbose
- name: Test
run: yarn test-ci
- name: Log file artifacts
Expand Down
3 changes: 3 additions & 0 deletions .mocharc-windows-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"timeout": "25000"
}
3 changes: 3 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"timeout": "5000"
}
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
"test-run-in-terminal": "yarn test:pty && yarn test:integration-run-in-terminal && yarn test:integration-remote-target-run-in-terminal",
"test:integration": "cross-env JUNIT_REPORT_PATH=test-reports/integration.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts",
"test:integration-run-in-terminal": "cross-env JUNIT_REPORT_PATH=test-reports/integration-run-in-terminal.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --run-in-terminal --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts",
"test:integration-remote-target": "cross-env JUNIT_REPORT_PATH=test-reports/integration-remote-target.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --test-remote --timeout 5000 --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts",
"test:integration-remote-target-run-in-terminal": "cross-env JUNIT_REPORT_PATH=test-reports/integration-remote-target-run-in-terminal.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --test-remote --timeout 5000 --run-in-terminal --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts",
"test:integration-remote-target": "cross-env JUNIT_REPORT_PATH=test-reports/integration-remote-target.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --test-remote --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts",
"test:integration-remote-target-run-in-terminal": "cross-env JUNIT_REPORT_PATH=test-reports/integration-remote-target-run-in-terminal.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --test-remote --run-in-terminal --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts",
"test:integration-gdb-async-off": "cross-env JUNIT_REPORT_PATH=test-reports/integration-gdb-async-off.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts --test-gdb-async-off",
"test:integration-gdb-async-off-remote-target": "cross-env JUNIT_REPORT_PATH=test-reports/integration-gdb-async-off-remote-target.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts --timeout 5000 --test-gdb-async-off --test-remote",
"test:integration-gdb-async-off-remote-target": "cross-env JUNIT_REPORT_PATH=test-reports/integration-gdb-async-off-remote-target.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts --test-gdb-async-off --test-remote",
"test:integration-gdb-non-stop": "cross-env JUNIT_REPORT_PATH=test-reports/integration-gdb-non-stop.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts --test-gdb-non-stop",
"test:integration-gdb-non-stop-remote-target": "cross-env JUNIT_REPORT_PATH=test-reports/integration-gdb-non-stop-remote-target.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts --test-gdb-non-stop --test-remote",
"test:pty": "cross-env JUNIT_REPORT_PATH=test-reports/native.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --reporter mocha-jenkins-reporter dist/native/*.spec.js",
"test-ci": "run-s --continue-on-error test-ci:integration test-ci:integration-remote-target test-ci:integration-gdb-async-off test-ci:integration-gdb-async-off-remote-target test-ci:integration-gdb-non-stop test-ci:integration-gdb-non-stop-remote-target",
"test-ci:integration": "cross-env JUNIT_REPORT_PATH=test-reports/integration.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --skip-make --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts",
"test-ci:integration-run-in-terminal": "cross-env JUNIT_REPORT_PATH=test-reports/integration-run-in-terminal.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --skip-make --run-in-terminal --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts",
"test-ci:integration-remote-target": "cross-env JUNIT_REPORT_PATH=test-reports/integration-remote-target.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --skip-make --test-remote --timeout 5000 --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts",
"test-ci:integration-remote-target-run-in-terminal": "cross-env JUNIT_REPORT_PATH=test-reports/integration-remote-target-run-in-terminal.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --skip-make --test-remote --timeout 5000 --run-in-terminal --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts",
"test-ci:integration-remote-target": "cross-env JUNIT_REPORT_PATH=test-reports/integration-remote-target.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --skip-make --test-remote --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts",
"test-ci:integration-remote-target-run-in-terminal": "cross-env JUNIT_REPORT_PATH=test-reports/integration-remote-target-run-in-terminal.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --skip-make --test-remote --run-in-terminal --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts",
"test-ci:integration-gdb-async-off": "cross-env JUNIT_REPORT_PATH=test-reports/integration-gdb-async-off.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --skip-make --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts --test-gdb-async-off",
"test-ci:integration-gdb-async-off-remote-target": "cross-env JUNIT_REPORT_PATH=test-reports/integration-gdb-async-off-remote-target.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --skip-make --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts --timeout 5000 --test-gdb-async-off --test-remote",
"test-ci:integration-gdb-async-off-remote-target": "cross-env JUNIT_REPORT_PATH=test-reports/integration-gdb-async-off-remote-target.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --skip-make --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts --test-gdb-async-off --test-remote",
"test-ci:integration-gdb-non-stop": "cross-env JUNIT_REPORT_PATH=test-reports/integration-gdb-non-stop.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --skip-make --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts --test-gdb-non-stop",
"test-ci:integration-gdb-non-stop-remote-target": "cross-env JUNIT_REPORT_PATH=test-reports/integration-gdb-non-stop-remote-target.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --skip-make --reporter mocha-jenkins-reporter -r ts-node/register src/integration-tests/*.spec.ts --test-gdb-non-stop --test-remote",
"test-ci:pty": "cross-env JUNIT_REPORT_PATH=test-reports/native.xml JUNIT_REPORT_STACK=1 JUNIT_REPORT_PACKAGES=1 mocha --exit --skip-make --reporter mocha-jenkins-reporter dist/native/*.spec.js"
Expand Down
4 changes: 0 additions & 4 deletions src/integration-tests/GDBBackend.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ describe('GDB Backend Test Suite', function () {
afterEach(function () {
gdb.sendGDBExit();
});
// Move the timeout out of the way if the adapter is going to be debugged.
if (process.env.INSPECT_DEBUG_ADAPTER) {
this.timeout(9999999);
}

it('can read a value from -gdb-show', async function () {
const response = await gdb.sendGDBShow('width');
Expand Down
6 changes: 0 additions & 6 deletions src/integration-tests/attachRemote.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ describe('attach remote', function () {
await dc.stop();
});

this.timeout(5000);
// Move the timeout out of the way if the adapter is going to be debugged.
if (process.env.INSPECT_DEBUG_ADAPTER) {
this.timeout(9999999);
}

it('can attach remote and hit a breakpoint', async function () {
await dc.hitBreakpoint(
fillDefaults(this.test, {
Expand Down
9 changes: 0 additions & 9 deletions src/integration-tests/evaluate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ describe('evaluate request', function () {
const evaluateSrc = path.join(testProgramsDir, 'evaluate.cpp');

beforeEach(async function () {
// Move the timeout out of the way if the adapter is going to be debugged.
if (process.env.INSPECT_DEBUG_ADAPTER) {
this.timeout(9999999);
}
dc = await standardBeforeEach();
await dc.hitBreakpoint(
fillDefaults(this.currentTest, {
Expand All @@ -49,11 +45,6 @@ describe('evaluate request', function () {
await dc.stop();
});

// Move the timeout out of the way if the adapter is going to be debugged.
if (process.env.INSPECT_DEBUG_ADAPTER) {
this.timeout(9999999);
}

it('should evaluate a simple literal expression', async function () {
const res = await dc.evaluateRequest({
context: 'repl',
Expand Down
5 changes: 0 additions & 5 deletions src/integration-tests/launch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ describe('launch', function () {
await dc.stop();
});

// Move the timeout out of the way if the adapter is going to be debugged.
if (process.env.INSPECT_DEBUG_ADAPTER) {
this.timeout(9999999);
}

it('can launch and hit a breakpoint', async function () {
await dc.hitBreakpoint(
fillDefaults(this.test, {
Expand Down
5 changes: 0 additions & 5 deletions src/integration-tests/launchRemote.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ describe('launch remote', function () {
await dc.stop();
});

// Move the timeout out of the way if the adapter is going to be debugged.
if (process.env.INSPECT_DEBUG_ADAPTER) {
this.timeout(9999999);
}

it('can launch remote and hit a breakpoint', async function () {
await dc.hitBreakpoint(
fillDefaults(this.test, {
Expand Down
2 changes: 0 additions & 2 deletions src/integration-tests/multithread.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import { fail } from 'assert';
import * as os from 'os';

describe('multithread', async function () {
this.timeout(5000);

let dc: CdtDebugClient;
const program = path.join(testProgramsDir, 'MultiThread');
const source = path.join(testProgramsDir, 'MultiThread.cc');
Expand Down
4 changes: 0 additions & 4 deletions src/integration-tests/var.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ describe('Variables Test Suite', function () {
await dc.stop();
});

// Move the timeout out of the way if the adapter is going to be debugged.
if (process.env.INSPECT_DEBUG_ADAPTER) {
this.timeout(9999999);
}
it('can read and set simple variables in a program', async function () {
// read the variables
let vr = scope.scopes.body.scopes[0].variablesReference;
Expand Down
10 changes: 0 additions & 10 deletions src/integration-tests/vars_cpp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
standardBeforeEach,
testProgramsDir,
verifyVariable,
isRemoteTest,
fillDefaults,
} from './utils';

Expand All @@ -34,15 +33,6 @@ describe('Variables CPP Test Suite', function () {
'STOP HERE': 0,
};

// Move the timeout out of the way if the adapter is going to be debugged.
if (process.env.INSPECT_DEBUG_ADAPTER) {
this.timeout(9999999);
} else if (isRemoteTest) {
// On remote targets it can take quite a while to read all libc/libm
// over the remote connection, so increase the timeout
this.timeout(5000);
}

before(function () {
resolveLineTagLocations(varsCppSrc, lineTags);
});
Expand Down

0 comments on commit 3708cea

Please sign in to comment.