Skip to content

chore(NODE-6018): run entire BSON suite on a big endian machine #726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 19 additions & 30 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@ functions:
args:
- .evergreen/run-tests.sh

run big endian tests:
- command: subprocess.exec
type: test
params:
working_dir: src
add_expansions_to_env: true
binary: bash
args:
- .evergreen/run-big-endian-test.sh

run checks:
- command: subprocess.exec
type: test
Expand Down Expand Up @@ -165,6 +155,14 @@ tasks:
NODE_LTS_VERSION: 20
- func: install dependencies
- func: run tests
- name: node-tests-v22
tags: ["node"]
commands:
- func: fetch source
vars:
NODE_LTS_VERSION: 22
- func: install dependencies
- func: run tests
- name: node-tests-latest
tags: ["node"]
commands:
Expand All @@ -180,7 +178,7 @@ tasks:
commands:
- func: fetch source
vars:
NODE_LTS_VERSION: 20
NODE_LTS_VERSION: 22
- func: install dependencies
- func: run tests
vars:
Expand All @@ -189,15 +187,15 @@ tasks:
commands:
- func: fetch source
vars:
NODE_LTS_VERSION: 20
NODE_LTS_VERSION: 22
- func: install dependencies
- func: run bundling
- name: no-bigint-web-tests
tags: ["no-bigint", "web"]
commands:
- func: fetch source
vars:
NODE_LTS_VERSION: 20
NODE_LTS_VERSION: 22
- func: install dependencies
- func: run tests
vars:
Expand All @@ -209,14 +207,14 @@ tasks:
commands:
- func: fetch source
vars:
NODE_LTS_VERSION: 20
NODE_LTS_VERSION: 22
- func: install dependencies
- func: run checks
- name: check-typescript-oldest
commands:
- func: fetch source
vars:
NODE_LTS_VERSION: 20
NODE_LTS_VERSION: 22
- func: install dependencies
- func: "run typescript"
vars:
Expand All @@ -226,7 +224,7 @@ tasks:
commands:
- func: fetch source
vars:
NODE_LTS_VERSION: 20
NODE_LTS_VERSION: 22
- func: install dependencies
- func: "run typescript"
vars:
Expand All @@ -236,7 +234,7 @@ tasks:
commands:
- func: fetch source
vars:
NODE_LTS_VERSION: 20
NODE_LTS_VERSION: 22
- func: install dependencies
- func: "run typescript"
vars:
Expand Down Expand Up @@ -288,28 +286,19 @@ tasks:
commands:
- func: fetch source
vars:
NODE_LTS_VERSION: 20
NODE_LTS_VERSION: 22
- func: install dependencies
- func: run eslint plugin tests
- name: node-tests-big-endian
commands:
- func: fetch source
vars:
NODE_LTS_VERSION: 20
- func: install dependencies
vars:
NPM_OPTIONS: "--ignore-scripts"
- func: run big endian tests

buildvariants:
- name: linux
display_name: RHEL 8.0
run_on: rhel80-small
tasks: [".node", ".web", "check-eslint-plugin"]
- name: linux-zseries
display_name: RHEL 8.3 zSeries
run_on: rhel83-zseries-small
tasks: ["node-tests-big-endian"]
display_name: RHEL 9.0 zSeries
run_on: rhel9-zseries-small
tasks: [".node", ".web"]
- name: lint
display_name: lint
run_on: rhel80-small
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ FLOAT[0] = -1;
// Big endian [191, 240, 0, 0, 0, 0, 0, 0]
const isBigEndian = FLOAT_BYTES[7] === 0;

context(`handles big endianness correctly`, () => {
describe(`handles big endianness correctly`, () => {
before(function () {
if (!isBigEndian) {
throw new Error('expected to only run on big endian system');
this.skip();
}
});

Expand Down
4 changes: 3 additions & 1 deletion test/node/double.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,9 @@ describe('BSON Double Precision', function () {
expect(type).to.equal(BSON_DATA_NUMBER);
expect(type).to.not.equal(BSON_DATA_INT);
expect(serializedDouble.subarray(7, 15)).to.deep.equal(
new Uint8Array(new Float64Array([-0]).buffer)
// Use this on an LE system to re-create the following bytes:
// new Uint8Array(new Float64Array([-0]).buffer)
new Uint8Array([0, 0, 0, 0, 0, 0, 0, 128])
);
});

Expand Down
14 changes: 13 additions & 1 deletion test/node/release.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ const REQUIRED_FILES = [

describe(`Release ${packFile}`, function () {
let tarFileList;

before(function () {
if (process.arch !== 'x64') {
// This test doesn't need to run more than once on one of our platforms.
this.skip();
}
});

before(function () {
this.timeout(120_000); // npm pack can be slow
expect(fs.existsSync(packFile), `expected ${packFile} to NOT exist`).to.equal(false);
Expand All @@ -81,7 +89,11 @@ describe(`Release ${packFile}`, function () {
});

after(() => {
fs.unlinkSync(packFile);
try {
fs.unlinkSync(packFile);
} catch (error) {
if (error.code !== 'ENOENT') throw error;
}
});

for (const requiredFile of REQUIRED_FILES) {
Expand Down