Skip to content

Commit

Permalink
test: Update the tests to ffi-napi
Browse files Browse the repository at this point in the history
  • Loading branch information
felixrieseberg committed Oct 7, 2024
1 parent 0f74e98 commit 900d428
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 65 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"node": ">=12.13.0"
},
"dependencies": {
"@electron/node-gyp": "/~https://github.com/electron/node-gyp#9abc964e4fec714b0de1231c5769ce61e50dc65d",
"@electron/node-gyp": "/~https://github.com/electron/node-gyp#6424f618322303560cc57f13566413132e74984a",
"@malept/cross-spawn-promise": "^2.0.0",
"chalk": "^4.0.0",
"debug": "^4.1.1",
Expand Down
2 changes: 1 addition & 1 deletion test/fixture/native-app1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"devDependencies": {
"@types/node": "^12.0.10",
"ffi-napi": "4.0.3"
"ffi-rs": "1.0.96"
},
"dependencies": {
"@newrelic/native-metrics": "5.3.0",
Expand Down
112 changes: 66 additions & 46 deletions test/fixture/native-app1/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,56 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240"
integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==

"@yuuang/ffi-rs-darwin-arm64@1.0.96":
version "1.0.96"
resolved "https://registry.yarnpkg.com/@yuuang/ffi-rs-darwin-arm64/-/ffi-rs-darwin-arm64-1.0.96.tgz#924674202aec53943ca7531dbed7c29331ab78bd"
integrity sha512-ktbHLC3Du7rQgQkQodQgKoLkaG41keIExYCKjPtZEexaP2FWTDSf5WisytDoDr7Jsa47liyVkj1W7Umdga4nAA==

"@yuuang/ffi-rs-darwin-x64@1.0.96":
version "1.0.96"
resolved "https://registry.yarnpkg.com/@yuuang/ffi-rs-darwin-x64/-/ffi-rs-darwin-x64-1.0.96.tgz#293b84ae07b89de501b464085ef994a108c6d397"
integrity sha512-TmFMkxhbRBvzsq6ZpnedzFqMOONxbeIR4CrElFoE/bNE+1kWnN6U9PLixso0Dd0Jo+flzNnPGMK7haDwB6CeTg==

"@yuuang/ffi-rs-linux-arm-gnueabihf@1.0.96":
version "1.0.96"
resolved "https://registry.yarnpkg.com/@yuuang/ffi-rs-linux-arm-gnueabihf/-/ffi-rs-linux-arm-gnueabihf-1.0.96.tgz#ffe81af42e6dca65cd8c7be700e54b0873580c56"
integrity sha512-kOoQS0RK2iDM+GrNf/bCR7d7U6HTZR2jThqwDk3qUToc/ww5KGhbHCTJcAljgeYZJNsf5DvlIbKP6XJjUGQ6og==

"@yuuang/ffi-rs-linux-arm64-gnu@1.0.96":
version "1.0.96"
resolved "https://registry.yarnpkg.com/@yuuang/ffi-rs-linux-arm64-gnu/-/ffi-rs-linux-arm64-gnu-1.0.96.tgz#c40102cc61ce34c51fc29d0f054291fc32c7a38f"
integrity sha512-gwCziva9a1ok0XD+/IANESiA7USAqU7oR/T3L/f4iX1eZI7+PodD05fn7/Ullkaj5Fr3v1Q+CMi0H308l0T5uQ==

"@yuuang/ffi-rs-linux-arm64-musl@1.0.96":
version "1.0.96"
resolved "https://registry.yarnpkg.com/@yuuang/ffi-rs-linux-arm64-musl/-/ffi-rs-linux-arm64-musl-1.0.96.tgz#4790bb05e1861437de2bff59bc62fafe799e3215"
integrity sha512-IDNIjrmd1iRgH5sjS52TUVH/ZJzpnDgHHZ6WttOK35msyC1KXHaEvQN5P32EFdBdyKCNbOtnErBYFnEz+aapqA==

"@yuuang/ffi-rs-linux-x64-gnu@1.0.96":
version "1.0.96"
resolved "https://registry.yarnpkg.com/@yuuang/ffi-rs-linux-x64-gnu/-/ffi-rs-linux-x64-gnu-1.0.96.tgz#57aa8fafb76e73971fbcc5e1bcb5a2e33987516a"
integrity sha512-UvTLbkokFXLt8tjlO+yZPKfys/NdNfcjT0m/YuGImF/Jp5WrqcZ27tuAf60JG1f5weRGy3V+9bFHdWYymrzz/g==

"@yuuang/ffi-rs-linux-x64-musl@1.0.96":
version "1.0.96"
resolved "https://registry.yarnpkg.com/@yuuang/ffi-rs-linux-x64-musl/-/ffi-rs-linux-x64-musl-1.0.96.tgz#d311677c65e2150a1e7856c98616846e1de0d29b"
integrity sha512-9fahKTHCq6pjmJoc9P7/qfhWLD6ydP3unFt79X6AquDXel2Cobd2B5D2/DQqgdLuf8+ijHB9XGel3PVxLh2t1A==

"@yuuang/ffi-rs-win32-arm64-msvc@1.0.96":
version "1.0.96"
resolved "https://registry.yarnpkg.com/@yuuang/ffi-rs-win32-arm64-msvc/-/ffi-rs-win32-arm64-msvc-1.0.96.tgz#8eda9e87718a80c43c9a661b003669853bc4cae6"
integrity sha512-lje7z6UVMigJTpVW6kRHt+od76CEnCbFDA1tsn0Bsb+bUDKIP3/jsxoKoj0lECV1SIxn8ABKiL76AkXQXrQiDw==

"@yuuang/ffi-rs-win32-ia32-msvc@1.0.96":
version "1.0.96"
resolved "https://registry.yarnpkg.com/@yuuang/ffi-rs-win32-ia32-msvc/-/ffi-rs-win32-ia32-msvc-1.0.96.tgz#debbafcd13f56d6cda5025d3288356d2c5e2a780"
integrity sha512-2gvyiJ1ytlaLBucE32ozT13glx6JE0QGV39LL5UCSQcUYmRDqwgHPiGLizD4WkMmHzp4KpK5vc/r5W2RpTZgiQ==

"@yuuang/ffi-rs-win32-x64-msvc@1.0.96":
version "1.0.96"
resolved "https://registry.yarnpkg.com/@yuuang/ffi-rs-win32-x64-msvc/-/ffi-rs-win32-x64-msvc-1.0.96.tgz#fd23c997db6772a705640fea938fa0c1d2c152f6"
integrity sha512-qZnumYiQfpAnSz8KTbVs21ZkHc4R+rcG7L29KPFdUbRCvxLdaGeMa9ta8Hmgtbzs7z+N/UhGA3Ef1LIh5pSEtQ==

abbrev@1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
Expand Down Expand Up @@ -263,7 +313,7 @@ core-util-is@~1.0.0:
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85"
integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==

debug@4, debug@^4.1.1, debug@^4.3.3:
debug@4, debug@^4.3.3:
version "4.3.5"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e"
integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==
Expand Down Expand Up @@ -371,17 +421,21 @@ farmhash@3.2.1:
node-addon-api "^3.1.0"
prebuild-install "^6.0.1"

ffi-napi@4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/ffi-napi/-/ffi-napi-4.0.3.tgz#27a8d42a8ea938457154895c59761fbf1a10f441"
integrity sha512-PMdLCIvDY9mS32RxZ0XGb95sonPRal8aqRhLbeEtWKZTe2A87qRFG9HjOhvG8EX2UmQw5XNRMIOT+1MYlWmdeg==
dependencies:
debug "^4.1.1"
get-uv-event-loop-napi-h "^1.0.5"
node-addon-api "^3.0.0"
node-gyp-build "^4.2.1"
ref-napi "^2.0.1 || ^3.0.2"
ref-struct-di "^1.1.0"
ffi-rs@1.0.96:
version "1.0.96"
resolved "https://registry.yarnpkg.com/ffi-rs/-/ffi-rs-1.0.96.tgz#1200f731fccc0507e5e03d0a07a9b2a472fbd2f5"
integrity sha512-YrmOEr4bC2rnsvid42f/qkR8NJcW9agbHgYvBsF2aB0S59OCEpdAtlS7e+P6pmiOrR4FQgo62hMv6bRyM04NlA==
optionalDependencies:
"@yuuang/ffi-rs-darwin-arm64" "1.0.96"
"@yuuang/ffi-rs-darwin-x64" "1.0.96"
"@yuuang/ffi-rs-linux-arm-gnueabihf" "1.0.96"
"@yuuang/ffi-rs-linux-arm64-gnu" "1.0.96"
"@yuuang/ffi-rs-linux-arm64-musl" "1.0.96"
"@yuuang/ffi-rs-linux-x64-gnu" "1.0.96"
"@yuuang/ffi-rs-linux-x64-musl" "1.0.96"
"@yuuang/ffi-rs-win32-arm64-msvc" "1.0.96"
"@yuuang/ffi-rs-win32-ia32-msvc" "1.0.96"
"@yuuang/ffi-rs-win32-x64-msvc" "1.0.96"

file-uri-to-path@1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -455,18 +509,6 @@ gauge@~2.7.3:
strip-ansi "^3.0.1"
wide-align "^1.1.0"

get-symbol-from-current-process-h@^1.0.1, get-symbol-from-current-process-h@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/get-symbol-from-current-process-h/-/get-symbol-from-current-process-h-1.0.2.tgz#510af52eaef873f7028854c3377f47f7bb200265"
integrity sha512-syloC6fsCt62ELLrr1VKBM1ggOpMdetX9hTrdW77UQdcApPHLmf7CI7OKcN1c9kYuNxKcDe4iJ4FY9sX3aw2xw==

get-uv-event-loop-napi-h@^1.0.5:
version "1.0.6"
resolved "https://registry.yarnpkg.com/get-uv-event-loop-napi-h/-/get-uv-event-loop-napi-h-1.0.6.tgz#42b0b06b74c3ed21fbac8e7c72845fdb7a200208"
integrity sha512-t5c9VNR84nRoF+eLiz6wFrEp1SE2Acg0wS+Ysa2zF0eROes+LzOfuTaVHxGy8AbS8rq7FHEJzjnCZo1BupwdJg==
dependencies:
get-symbol-from-current-process-h "^1.0.1"

github-from-package@0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce"
Expand Down Expand Up @@ -939,11 +981,6 @@ node-fetch@^2.6.7:
dependencies:
whatwg-url "^5.0.0"

node-gyp-build@^4.2.1:
version "4.8.0"
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.0.tgz#3fee9c1731df4581a3f9ead74664369ff00d26dd"
integrity sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og==

node-gyp-build@~4.1.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.1.1.tgz#d7270b5d86717068d114cc57fff352f96d745feb"
Expand Down Expand Up @@ -1190,23 +1227,6 @@ ref-napi@1.4.2:
debug "^3.1.0"
node-addon-api "^1.6.2"

"ref-napi@^2.0.1 || ^3.0.2":
version "3.0.3"
resolved "https://registry.yarnpkg.com/ref-napi/-/ref-napi-3.0.3.tgz#e259bfc2bbafb3e169e8cd9ba49037dd00396b22"
integrity sha512-LiMq/XDGcgodTYOMppikEtJelWsKQERbLQsYm0IOOnzhwE9xYZC7x8txNnFC9wJNOkPferQI4vD4ZkC0mDyrOA==
dependencies:
debug "^4.1.1"
get-symbol-from-current-process-h "^1.0.2"
node-addon-api "^3.0.0"
node-gyp-build "^4.2.1"

ref-struct-di@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ref-struct-di/-/ref-struct-di-1.1.1.tgz#5827b1d3b32372058f177547093db1fe1602dc10"
integrity sha512-2Xyn/0Qgz89VT+++WP0sTosdm9oeowLP23wRJYhG4BFdMUrLj3jhwHZNEytYNYgtPKLNTP3KJX4HEgBvM1/Y2g==
dependencies:
debug "^3.1.0"

retry@^0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b"
Expand Down
18 changes: 9 additions & 9 deletions test/rebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('rebuilder', () => {
});

it('should not have rebuilt top level devDependencies', async () => {
await expectNativeModuleToNotBeRebuilt(testModulePath, 'ffi-napi');
await expectNativeModuleToNotBeRebuilt(testModulePath, 'ffi-rs');
});

it('should not download files in the module directory', async () => {
Expand Down Expand Up @@ -169,7 +169,7 @@ describe('rebuilder', () => {
buildPath: testModulePath,
electronVersion: testElectronVersion,
arch: process.arch,
onlyModules: ['ffi-napi', 'ref-napi'], // TODO: check to see if there's a bug with scoped modules
onlyModules: ['ffi-rs', 'ref-napi'], // TODO: check to see if there's a bug with scoped modules
force: true
});
let built = 0;
Expand All @@ -185,17 +185,17 @@ describe('rebuilder', () => {
before(async () => await resetTestModule(testModulePath));
after(async() => await cleanupTestModule(testModulePath));

it('should have rebuilt ffi-napi module in Debug mode', async () => {
it('should have rebuilt ffi-rs module in Debug mode', async () => {
await rebuild({
buildPath: testModulePath,
electronVersion: testElectronVersion,
arch: process.arch,
onlyModules: ['ffi-napi'],
onlyModules: ['ffi-rs'],
force: true,
debug: true
});
await expectNativeModuleToBeRebuilt(testModulePath, 'ffi-napi', { buildType: 'Debug' });
await expectNativeModuleToNotBeRebuilt(testModulePath, 'ffi-napi');
await expectNativeModuleToBeRebuilt(testModulePath, 'ffi-rs', { buildType: 'Debug' });
await expectNativeModuleToNotBeRebuilt(testModulePath, 'ffi-rs');
});
});

Expand All @@ -205,16 +205,16 @@ describe('rebuilder', () => {
before(async () => await resetTestModule(testModulePath));
after(async() => await cleanupTestModule(testModulePath));

it('should have rebuilt ffi-napi module using clang mode', async () => {
it('should have rebuilt ffi-rs module using clang mode', async () => {
await rebuild({
buildPath: testModulePath,
electronVersion: testElectronVersion,
arch: process.arch,
onlyModules: ['ffi-napi'],
onlyModules: ['ffi-rs'],
force: true,
useElectronClang: true
});
await expectNativeModuleToBeRebuilt(testModulePath, 'ffi-napi');
await expectNativeModuleToBeRebuilt(testModulePath, 'ffi-rs');
});
});
});
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@
optionalDependencies:
global-agent "^3.0.0"

"@electron/node-gyp@/~https://github.com/electron/node-gyp#9abc964e4fec714b0de1231c5769ce61e50dc65d":
"@electron/node-gyp@/~https://github.com/electron/node-gyp#6424f618322303560cc57f13566413132e74984a":
version "10.2.0-electron.1"
resolved "/~https://github.com/electron/node-gyp#9abc964e4fec714b0de1231c5769ce61e50dc65d"
resolved "/~https://github.com/electron/node-gyp#6424f618322303560cc57f13566413132e74984a"
dependencies:
env-paths "^2.2.0"
exponential-backoff "^3.1.1"
Expand Down Expand Up @@ -571,9 +571,9 @@
integrity sha512-XImEz7XwTvDBtzlTnm8YvMqGW/ErMWBsKZ+hMTvnDIjGCKxwK5Xpc+c/oQjOauwq8M4OS11hEkpjX8rrI/eEgA==

"@types/node@^16.11.26":
version "16.18.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.4.tgz#712ba61b4caf091fc6490301b1888356638c17bd"
integrity sha512-9qGjJ5GyShZjUfx2ArBIGM+xExdfLvvaCyQR0t6yRXKPcWCVYF/WemtX/uIU3r7FYECXRXkIiw2Vnhn6y8d+pw==
version "16.18.112"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.112.tgz#efd468e4edd08404eed23b6aed6c2f35edfa9450"
integrity sha512-EKrbKUGJROm17+dY/gMi31aJlGLJ75e1IkTojt9n6u+hnaTBDs+M1bIdOawpk2m6YUAXq/R2W0SxCng1tndHCg==

"@types/responselike@*", "@types/responselike@^1.0.0":
version "1.0.0"
Expand Down Expand Up @@ -1301,9 +1301,9 @@ electron-to-chromium@^1.3.793:
integrity sha512-V2rbYWdGvSqrg+95KjkVuSi41bGfrhrOzjl1tSi2VLnm0mRe3FsSvhiqidSiSll9WiMhrQAhpDcW/wcqK3c+Yw==

electron@^22.0.0:
version "22.3.25"
resolved "https://registry.yarnpkg.com/electron/-/electron-22.3.25.tgz#a9a70b63a6712c658cd7fab343129b2a78450f80"
integrity sha512-AjrP7bebMs/IPsgmyowptbA7jycTkrJC7jLZTb5JoH30PkBC6pZx/7XQ0aDok82SsmSiF4UJDOg+HoLrEBiqmg==
version "22.3.27"
resolved "https://registry.yarnpkg.com/electron/-/electron-22.3.27.tgz#b77451a53f0c502e7559cceac28ac58eb289eef8"
integrity sha512-7Rht21vHqj4ZFRnKuZdFqZFsvMBCmDqmjetiMqPtF+TmTBiGne1mnstVXOA/SRGhN2Qy5gY5bznJKpiqogjM8A==
dependencies:
"@electron/get" "^2.0.0"
"@types/node" "^16.11.26"
Expand Down

0 comments on commit 900d428

Please sign in to comment.