| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8feb273 commit f756378
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -294,7 +294,6 @@ coverage-report-js: ## Report JavaScript coverage results. | |||
| 294 | 294 | cctest: all ## Run the C++ tests using the built `cctest` executable. | |
| 295 | 295 | @out/$(BUILDTYPE)/$@ --gtest_filter=$(GTEST_FILTER) | |
| 296 | 296 | $(NODE) ./test/embedding/test-embedding.js | |
| 297 | - $(NODE) ./test/sqlite/test-sqlite-extensions.mjs | ||
| 298 | 297 | ||
| 299 | 298 | .PHONY: list-gtests | |
| 300 | 299 | list-gtests: ## List all available C++ gtests. | |
@@ -312,7 +311,7 @@ v8: ## Build deps/v8. | |||
| 312 | 311 | tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS) | |
| 313 | 312 | ||
| 314 | 313 | .PHONY: jstest | |
| 315 | - jstest: build-addons build-js-native-api-tests build-node-api-tests ## Run addon tests and JS tests. | ||
| 314 | + jstest: build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests ## Run addon tests and JS tests. | ||
| 316 | 315 | $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \ | |
| 317 | 316 | $(TEST_CI_ARGS) \ | |
| 318 | 317 | --skip-tests=$(CI_SKIP_TESTS) \ | |
@@ -338,6 +337,7 @@ test: all ## Run default tests, linters, and build docs. | |||
| 338 | 337 | $(MAKE) -s build-addons | |
| 339 | 338 | $(MAKE) -s build-js-native-api-tests | |
| 340 | 339 | $(MAKE) -s build-node-api-tests | |
| 340 | + $(MAKE) -s build-sqlite-tests | ||
| 341 | 341 | $(MAKE) -s cctest | |
| 342 | 342 | $(MAKE) -s jstest | |
| 343 | 343 | ||
@@ -346,6 +346,7 @@ test-only: all ## Run default tests, without linters or building the docs. | |||
| 346 | 346 | $(MAKE) build-addons | |
| 347 | 347 | $(MAKE) build-js-native-api-tests | |
| 348 | 348 | $(MAKE) build-node-api-tests | |
| 349 | + $(MAKE) build-sqlite-tests | ||
| 349 | 350 | $(MAKE) cctest | |
| 350 | 351 | $(MAKE) jstest | |
| 351 | 352 | $(MAKE) tooltest | |
@@ -356,6 +357,7 @@ test-cov: all ## Run coverage tests. | |||
| 356 | 357 | $(MAKE) build-addons | |
| 357 | 358 | $(MAKE) build-js-native-api-tests | |
| 358 | 359 | $(MAKE) build-node-api-tests | |
| 360 | + $(MAKE) build-sqlite-tests | ||
| 359 | 361 | $(MAKE) cctest | |
| 360 | 362 | CI_SKIP_TESTS=$(COV_SKIP_TESTS) $(MAKE) jstest | |
| 361 | 363 | ||
@@ -501,6 +503,23 @@ benchmark/napi/.buildstamp: $(ADDONS_PREREQS) \ | |||
| 501 | 503 | $(BENCHMARK_NAPI_BINDING_GYPS) $(BENCHMARK_NAPI_BINDING_SOURCES) | |
| 502 | 504 | @$(call run_build_addons,"$$PWD/benchmark/napi",$@) | |
| 503 | 505 | ||
| 506 | + SQLITE_BINDING_GYPS := $(wildcard test/sqlite/*/binding.gyp) | ||
| 507 | + | ||
| 508 | + SQLITE_BINDING_SOURCES := \ | ||
| 509 | + $(wildcard test/sqlite/*/*.c) | ||
| 510 | + | ||
| 511 | + # Implicitly depends on $(NODE_EXE), see the build-sqlite-tests rule for rationale. | ||
| 512 | + test/sqlite/.buildstamp: $(ADDONS_PREREQS) \ | ||
| 513 | + $(SQLITE_BINDING_GYPS) $(SQLITE_BINDING_SOURCES) | ||
| 514 | + @$(call run_build_addons,"$$PWD/test/sqlite",$@) | ||
| 515 | + | ||
| 516 | + .PHONY: build-sqlite-tests | ||
| 517 | + # .buildstamp needs $(NODE_EXE) but cannot depend on it | ||
| 518 | + # directly because it calls make recursively. The parent make cannot know | ||
| 519 | + # if the subprocess touched anything so it pessimistically assumes that | ||
| 520 | + # .buildstamp is out of date and need a rebuild. | ||
| 521 | + build-sqlite-tests: | $(NODE_EXE) test/sqlite/.buildstamp ## Build SQLite tests. | ||
| 522 | + | ||
| 504 | 523 | .PHONY: clear-stalled | |
| 505 | 524 | clear-stalled: ## Clear any stalled processes. | |
| 506 | 525 | $(info Clean up any leftover processes but don't error if found.) | |
@@ -511,14 +530,18 @@ clear-stalled: ## Clear any stalled processes. | |||
| 511 | 530 | fi | |
| 512 | 531 | ||
| 513 | 532 | .PHONY: test-build | |
| 514 | - test-build: | all build-addons build-js-native-api-tests build-node-api-tests ## Build all tests. | ||
| 533 | + test-build: | all build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests ## Build all tests. | ||
| 515 | 534 | ||
| 516 | 535 | .PHONY: test-build-js-native-api | |
| 517 | 536 | test-build-js-native-api: all build-js-native-api-tests ## Build JS Native-API tests. | |
| 518 | 537 | ||
| 519 | 538 | .PHONY: test-build-node-api | |
| 520 | 539 | test-build-node-api: all build-node-api-tests ## Build Node-API tests. | |
| 521 | 540 | ||
| 541 | + .PHONY: test-build-sqlite | ||
| 542 | + test-build-sqlite: all build-sqlite-tests ## Build SQLite tests. | ||
| 543 | + | ||
| 544 | + | ||
| 522 | 545 | .PHONY: test-all | |
| 523 | 546 | test-all: test-build ## Run default tests with both Debug and Release builds. | |
| 524 | 547 | $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=debug,release | |
@@ -546,7 +569,7 @@ endif | |||
| 546 | 569 | ||
| 547 | 570 | # Related CI job: node-test-commit-arm-fanned | |
| 548 | 571 | test-ci-native: LOGLEVEL := info ## Build and test addons without building anything else. | |
| 549 | - test-ci-native: | benchmark/napi/.buildstamp test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp | ||
| 572 | + test-ci-native: | benchmark/napi/.buildstamp test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp test/sqlite/.buildstamp | ||
| 550 | 573 | $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ | |
| 551 | 574 | --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ | |
| 552 | 575 | $(TEST_CI_ARGS) $(CI_NATIVE_SUITES) | |
@@ -569,13 +592,12 @@ test-ci-js: | clear-stalled ## Build and test JavaScript with building anything | |||
| 569 | 592 | .PHONY: test-ci | |
| 570 | 593 | # Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned | |
| 571 | 594 | test-ci: LOGLEVEL := info ## Build and test everything (CI). | |
| 572 | - test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tests build-node-api-tests doc-only | ||
| 595 | + test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests doc-only | ||
| 573 | 596 | out/Release/cctest --gtest_output=xml:out/junit/cctest.xml | |
| 574 | 597 | $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ | |
| 575 | 598 | --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ | |
| 576 | 599 | $(TEST_CI_ARGS) $(CI_JS_SUITES) $(CI_NATIVE_SUITES) $(CI_DOC) | |
| 577 | 600 | $(NODE) ./test/embedding/test-embedding.js | |
| 578 | - $(NODE) ./test/sqlite/test-sqlite-extensions.mjs | ||
| 579 | 601 | $(info Clean up any leftover processes, error if found.) | |
| 580 | 602 | ps awwx | grep Release/node | grep -v grep | cat | |
| 581 | 603 | @PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \ | |
@@ -681,6 +703,16 @@ test-node-api-clean: ## Remove Node-API testing artifacts. | |||
| 681 | 703 | $(RM) -r test/node-api/*/build | |
| 682 | 704 | $(RM) test/node-api/.buildstamp | |
| 683 | 705 | ||
| 706 | + .PHONY: test-sqlite | ||
| 707 | + test-sqlite: test-build-sqlite ## Run SQLite tests. | ||
| 708 | + $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) sqlite | ||
| 709 | + | ||
| 710 | + .PHONY: test-sqlite-clean | ||
| 711 | + .NOTPARALLEL: test-sqlite-clean | ||
| 712 | + test-sqlite-clean: ## Remove SQLite testing artifacts. | ||
| 713 | + $(RM) -r test/sqlite/*/build | ||
| 714 | + $(RM) test/sqlite/.buildstamp | ||
| 715 | + | ||
| 684 | 716 | .PHONY: test-addons | |
| 685 | 717 | test-addons: test-build test-js-native-api test-node-api ## Run addon tests. | |
| 686 | 718 | $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) addons | |
@@ -1446,7 +1478,7 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \ | |||
| 1446 | 1478 | test/cctest/*.h \ | |
| 1447 | 1479 | test/embedding/*.cc \ | |
| 1448 | 1480 | test/embedding/*.h \ | |
| 1449 | - test/sqlite/*.c \ | ||
| 1481 | + test/sqlite/*/*.c \ | ||
| 1450 | 1482 | test/fixtures/*.c \ | |
| 1451 | 1483 | test/js-native-api/*/*.cc \ | |
| 1452 | 1484 | test/node-api/*/*.cc \ | |
@@ -1470,6 +1502,7 @@ FORMAT_CPP_FILES += $(wildcard \ | |||
| 1470 | 1502 | test/js-native-api/*/*.h \ | |
| 1471 | 1503 | test/node-api/*/*.c \ | |
| 1472 | 1504 | test/node-api/*/*.h \ | |
| 1505 | + test/sqlite/*/*.c \ | ||
| 1473 | 1506 | ) | |
| 1474 | 1507 | ||
| 1475 | 1508 | # Code blocks don't have newline at the end, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1296,26 +1296,6 @@ | |||
| 1296 | 1296 | ], | |
| 1297 | 1297 | }, # embedtest | |
| 1298 | 1298 | ||
| 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 | - | ||
| 1319 | 1299 | { | |
| 1320 | 1300 | 'target_name': 'overlapped-checker', | |
| 1321 | 1301 | 'type': 'executable', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + build | ||
| Original file line number | Diff line number | Diff 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 | ||
| Original file line number | Diff line number | Diff 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 | + } | ||
| Original file line number | Diff line number | Diff 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'); | ||
| 9 | 9 | ||
| 10 | 10 | if (process.config.variables.node_shared_sqlite) { | |
| 11 | 11 | common.skip('Missing libsqlite_extension binary'); | |
| 12 | 12 | } | |
| 13 | 13 | ||
| 14 | 14 | // 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); | ||
| 18 | 20 | } | |
| 19 | 21 | ||
| 20 | - const binary = resolveBuiltBinary('libsqlite_extension'); | ||
| 22 | + const binary = resolveBuiltBinary(); | ||
| 21 | 23 | ||
| 22 | 24 | test('should load extension successfully', () => { | |
| 23 | 25 | const db = new sqlite.DatabaseSync(':memory:', { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,4 +3,4 @@ | |||
| 3 | 3 | import testpy | |
| 4 | 4 | ||
| 5 | 5 | def GetConfiguration(context, root): | |
| 6 | - return testpy.SimpleTestConfiguration(context, root, 'sqlite') | ||
| 6 | + return testpy.AddonTestConfiguration(context, root, 'sqlite') | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments