test: update compiled sqlite tests to match other tests · nodejs/node@f756378 · GitHub
Skip to content

Commit f756378

Browse files
cjihrigRafaelGSS
authored andcommitted
test: update compiled sqlite tests to match other tests
This commit updates the sqlite compiled tests to be structured like other compiled tests. Refs: #56347 PR-URL: #56446 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Stewart X Addison <sxa@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent 8feb273 commit f756378

8 files changed

Lines changed: 73 additions & 40 deletions

File tree

Makefile

Lines changed: 40 additions & 7 deletions

node.gyp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,26 +1296,6 @@
12961296
],
12971297
}, # embedtest
12981298

1299-
{
1300-
'target_name': 'sqlite_extension',
1301-
'type': 'shared_library',
1302-
'sources': [
1303-
'test/sqlite/extension.c'
1304-
],
1305-
1306-
'include_dirs': [
1307-
'test/sqlite',
1308-
'deps/sqlite',
1309-
],
1310-
1311-
'cflags': [
1312-
'-fPIC',
1313-
'-Wall',
1314-
'-Wextra',
1315-
'-O3',
1316-
],
1317-
}, # sqlitetest
1318-
13191299
{
13201300
'target_name': 'overlapped-checker',
13211301
'type': 'executable',

test/sqlite/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

test/sqlite/sqlite.status

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
prefix sqlite
2+
3+
# To mark a test as flaky, list the test name in the appropriate section
4+
# below, without ".js", followed by ": PASS,FLAKY". Example:
5+
# sample-test : PASS,FLAKY
6+
7+
[true] # This section applies to all platforms
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"targets": [
3+
{
4+
"target_name": "sqlite_extension",
5+
"type": "shared_library",
6+
"sources": [ "extension.c" ],
7+
"include_dirs": [ "../../../deps/sqlite" ]
8+
}
9+
]
10+
}

test/sqlite/extension.c renamed to test/sqlite/test_sqlite_extensions/extension.c

File renamed without changes.

test/sqlite/test-sqlite-extensions.mjs renamed to test/sqlite/test_sqlite_extensions/test.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1-
import * as common from '../common/index.mjs';
2-
3-
import assert from 'node:assert';
4-
import path from 'node:path';
5-
import sqlite from 'node:sqlite';
6-
import test from 'node:test';
7-
import fs from 'node:fs';
8-
import childProcess from 'child_process';
1+
'use strict';
2+
const common = require('../../common');
3+
const assert = require('node:assert');
4+
const path = require('node:path');
5+
const sqlite = require('node:sqlite');
6+
const test = require('node:test');
7+
const fs = require('node:fs');
8+
const childProcess = require('node:child_process');
99

1010
if (process.config.variables.node_shared_sqlite) {
1111
common.skip('Missing libsqlite_extension binary');
1212
}
1313

1414
// Lib extension binary is named differently on different platforms
15-
function resolveBuiltBinary(binary) {
16-
const targetFile = fs.readdirSync(path.dirname(process.execPath)).find((file) => file.startsWith(binary));
17-
return path.join(path.dirname(process.execPath), targetFile);
15+
function resolveBuiltBinary() {
16+
const buildDir = `${__dirname}/build/${common.buildType}`;
17+
const lib = 'sqlite_extension';
18+
const targetFile = fs.readdirSync(buildDir).find((file) => file.startsWith(lib));
19+
return path.join(buildDir, targetFile);
1820
}
1921

20-
const binary = resolveBuiltBinary('libsqlite_extension');
22+
const binary = resolveBuiltBinary();
2123

2224
test('should load extension successfully', () => {
2325
const db = new sqlite.DatabaseSync(':memory:', {

test/sqlite/testcfg.py

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)