1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
|
Description: The DEBUG variant has some issues with emscripten version in Debian
and is pretty much useless, so it is excluded from the build output and tests.
Last-Update: 2023-08-07
Author: Israel Galadima <izzygaladima@gmail.com>
Forwarded: not-needed
--- a/ts/quickjs.test.ts
+++ b/ts/quickjs.test.ts
@@ -16,7 +16,7 @@
import fs, { chmod } from "fs"
import { QuickJSContext } from "./context"
import { QuickJSAsyncContext } from "./context-asyncify"
-import { DEBUG_ASYNC, DEBUG_SYNC, memoizePromiseFactory, QuickJSFFI } from "./variants"
+import { memoizePromiseFactory, QuickJSFFI } from "./variants"
import { QuickJSUnwrapError } from "./errors"
import { debugLog } from "./debug"
import { EitherFFI } from "./types"
@@ -1021,11 +1021,14 @@
contextTests.call(this, getContext)
})
+ /**
describe("DEBUG sync module", function () {
const loader = memoizePromiseFactory(() => newQuickJSWASMModule(DEBUG_SYNC))
const getContext = () => loader().then((mod) => mod.newContext())
contextTests.call(this, getContext, true)
})
+ **/
+
})
if (!TEST_NO_ASYNC) {
@@ -1043,6 +1046,7 @@
})
})
+ /**
describe("DEBUG async module", function () {
const loader = memoizePromiseFactory(() => newQuickJSAsyncWASMModule(DEBUG_ASYNC))
const getContext = () => loader().then((mod) => mod.newContext())
@@ -1055,6 +1059,8 @@
asyncContextTests(getContext)
})
})
+ **/
+
})
}
--- a/ts/variants.test.ts
+++ b/ts/variants.test.ts
@@ -3,8 +3,6 @@
import { QuickJSWASMModule } from "./module"
import {
AsyncBuildVariant,
- DEBUG_ASYNC,
- DEBUG_SYNC,
RELEASE_ASYNC,
RELEASE_SYNC,
SyncBuildVariant,
@@ -42,6 +40,8 @@
assert.deepStrictEqual(getModuleBuildInfo(await getQuickJS()), DEFAULT_VARIANT)
})
})
+
+ /**
describe("DEBUG_SYNC", () => {
it("has expected build settings", async () => {
assert.deepStrictEqual(await getVariantBuildInfo(DEBUG_SYNC), {
@@ -52,6 +52,7 @@
})
})
})
+ **/
describe("RELEASE_SYNC", () => {
it("has expected build settings", async () => {
@@ -59,6 +60,7 @@
})
})
+ /**
describe("DEBUG_ASYNC", () => {
it("has expected build settings", async () => {
assert.deepStrictEqual(await getVariantBuildInfo(DEBUG_ASYNC), {
@@ -69,6 +71,7 @@
})
})
})
+ **/
describe("RELEASE_ASYNC", () => {
it("has expected build settings", async () => {
--- a/ts/leak.test.ts
+++ b/ts/leak.test.ts
@@ -1,7 +1,7 @@
import assert from "assert"
import { getQuickJS, newQuickJSAsyncWASMModule, newQuickJSWASMModule } from "."
import { QuickJSWASMModule } from "./module"
-import { DEBUG_ASYNC, DEBUG_SYNC, memoizePromiseFactory as memoizeNewModule } from "./variants"
+import { memoizePromiseFactory as memoizeNewModule } from "./variants"
const TEST_LEAK = Boolean(process.env.TEST_LEAK)
@@ -151,19 +151,23 @@
}
describe("Leak checks (most accurate with debug build)", function () {
+ /**
describe("DEBUG sync module", function () {
const loader = memoizeNewModule(() => newQuickJSWASMModule(DEBUG_SYNC))
checkModuleForLeaks.call(this, loader)
})
+ **/
describe("RELEASE sync module", function () {
checkModuleForLeaks.call(this, getQuickJS)
})
+ /**
describe.skip("DEBUG async module", function () {
const loader = memoizeNewModule(() => newQuickJSAsyncWASMModule(DEBUG_ASYNC))
checkModuleForLeaks.call(this, loader)
})
+ **/
// Leaving this enabled, but note that we now disable
// leak sanitizer for ASYNCIFY since it's not reliable.
--- a/ts/readme.test.ts
+++ b/ts/readme.test.ts
@@ -1,6 +1,5 @@
import assert from "assert"
import {
- DEBUG_SYNC,
getQuickJS,
newAsyncContext,
newQuickJSAsyncWASMModule,
@@ -291,10 +290,12 @@
}
// Run the test suite against a matrix of module loaders.
+ /**
describe("Check for memory leaks with QuickJS DEBUG build", () => {
const moduleLoader = memoizePromiseFactory(() => newQuickJSWASMModule(DEBUG_SYNC))
myTests(moduleLoader)
})
+ **/
describe("Realistic test with QuickJS RELEASE build", () => {
myTests(getQuickJS)
--- a/ts/variants.ts
+++ b/ts/variants.ts
@@ -1,6 +1,6 @@
-import type { QuickJSAsyncFFI as DebugAsyncifyFFI } from "./generated/ffi.WASM_DEBUG_ASYNCIFY"
+// import type { QuickJSAsyncFFI as DebugAsyncifyFFI } from "./generated/ffi.WASM_DEBUG_ASYNCIFY"
import type { QuickJSAsyncFFI as ReleaseAsyncifyFFI } from "./generated/ffi.WASM_RELEASE_ASYNCIFY"
-import type { QuickJSFFI as DebugSyncFFI } from "./generated/ffi.WASM_DEBUG_SYNC"
+// import type { QuickJSFFI as DebugSyncFFI } from "./generated/ffi.WASM_DEBUG_SYNC"
import type { QuickJSFFI as ReleaseSyncFFI } from "./generated/ffi.WASM_RELEASE_SYNC"
import type {
EmscriptenModuleLoader,
@@ -12,13 +12,13 @@
import { unwrapTypescript, unwrapJavascript } from "./esmHelpers"
/** @private */
-export type QuickJSFFI = DebugSyncFFI | ReleaseSyncFFI
+export type QuickJSFFI = ReleaseSyncFFI
/** @private */
-export type QuickJSFFIConstructor = typeof DebugSyncFFI | typeof ReleaseSyncFFI
+export type QuickJSFFIConstructor = typeof ReleaseSyncFFI
/** @private */
-export type QuickJSAsyncFFI = DebugAsyncifyFFI | ReleaseAsyncifyFFI
+export type QuickJSAsyncFFI = ReleaseAsyncifyFFI
/** @private */
-export type QuickJSAsyncFFIConstructor = typeof DebugAsyncifyFFI | typeof ReleaseAsyncifyFFI
+export type QuickJSAsyncFFIConstructor = typeof ReleaseAsyncifyFFI
/**
* quickjs-emscripten provides multiple build variants of the core WebAssembly
@@ -30,7 +30,6 @@
* Synchronous build variants:
*
* - {@link RELEASE_SYNC} - This is the default synchronous variant, for general purpose use.
- * - {@link DEBUG_SYNC} - Synchronous build variant for debugging memory leaks.
*/
export interface SyncBuildVariant {
type: "sync"
@@ -48,7 +47,6 @@
* Asyncified build variants:
*
* - {@link RELEASE_ASYNC} - This is the default asyncified build variant, for general purpose use.
- * - {@link DEBUG_ASYNC} - Asyncified build variant with debug logging.
*/
export interface AsyncBuildVariant {
type: "async"
@@ -114,7 +112,7 @@
/**
* Helper intended to memoize the creation of a WebAssembly module.
* ```typescript
- * const getDebugModule = memoizePromiseFactory(() => newQuickJSWASMModule(DEBUG_SYNC))
+ * const getDebugModule = memoizePromiseFactory(() => newQuickJSWASMModule())
* ```
*/
export function memoizePromiseFactory<T>(fn: () => Promise<T>): () => Promise<T> {
@@ -125,30 +123,6 @@
}
/**
- * This build variant is compiled with `-fsanitize=leak`. It instruments all
- * memory allocations and when combined with sourcemaps, can present stack trace
- * locations where memory leaks occur.
- *
- * See [[TestQuickJSWASMModule]] which provides access to the leak sanitizer via
- * {@link TestQuickJSWASMModule.assertNoMemoryAllocated}.
- *
- * The downside is that it's 100-1000x slower than the other variants.
- * Suggested use case: automated testing, regression testing, and interactive
- * debugging.
- */
-export const DEBUG_SYNC: SyncBuildVariant = {
- type: "sync",
- async importFFI() {
- const mod = await import("./generated/ffi.WASM_DEBUG_SYNC.js")
- return unwrapTypescript(mod).QuickJSFFI
- },
- async importModuleLoader() {
- const mod = await import("./generated/emscripten-module.WASM_DEBUG_SYNC.js")
- return unwrapJavascript(mod).default
- },
-}
-
-/**
* This is the default (synchronous) build variant.
* {@link getQuickJS} returns a memoized instance of this build variant.
*/
@@ -163,24 +137,6 @@
return unwrapJavascript(mod).default
},
}
-
-/**
- * The async debug build variant may or may not have the sanitizer enabled.
- * It does print a lot of debug logs.
- *
- * Suggested use case: interactive debugging only.
- */
-export const DEBUG_ASYNC: AsyncBuildVariant = {
- type: "async",
- async importFFI() {
- const mod = await import("./generated/ffi.WASM_DEBUG_ASYNCIFY.js")
- return unwrapTypescript(mod).QuickJSAsyncFFI
- },
- async importModuleLoader() {
- const mod = await import("./generated/emscripten-module.WASM_DEBUG_ASYNCIFY.js")
- return unwrapJavascript(mod).default
- },
-}
/**
* This is the default asyncified build variant.
--- a/ts/index.ts
+++ b/ts/index.ts
@@ -20,8 +20,6 @@
import {
newQuickJSWASMModule,
newQuickJSAsyncWASMModule,
- DEBUG_ASYNC,
- DEBUG_SYNC,
RELEASE_ASYNC,
RELEASE_SYNC,
SyncBuildVariant,
@@ -30,8 +28,6 @@
export {
newQuickJSWASMModule,
newQuickJSAsyncWASMModule,
- DEBUG_ASYNC,
- DEBUG_SYNC,
RELEASE_ASYNC,
RELEASE_SYNC,
SyncBuildVariant,
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@
# https://stackoverflow.com/questions/21246165/how-to-break-a-string-across-lines-in-a-makefile-without-spaces/50863019#50863019
VARY=PLATFORM RELEASE SYNC
VARY_PLATFORM:=WASM NATIVE
-VARY_RELEASE:=DEBUG RELEASE
+VARY_RELEASE:=RELEASE
VARY_SYNC:=SYNC ASYNCIFY
WASM_VARIANTS=$(foreach RELEASE,$(VARY_RELEASE),$(addprefix WASM_$(RELEASE)_,$(VARY_SYNC)))
|