Skip to content
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

Error: program file does not exist: ./target/deploy/counter_solana_native.so #67

Open
ksolana opened this issue Feb 18, 2024 · 1 comment

Comments

@ksolana
Copy link
Contributor

ksolana commented Feb 18, 2024

I'm trying to run the yarn test from counter/native directory.

$ pwd
~/program-examples/basics/counter/native

$ yarn test
Error: program file does not exist: ./target/deploy/counter_solana_native.so
Error: server closed unexpectedly
    at ChildProcess.onClose (program-examples/basics/counter/native/node_modules/start-server-and-test/src/index.js:80:14)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
error Command failed with exit code 1.

I think yarn should detect which directory the test is invoked from. There should be a way to know the project root and that should be prefixed to the target/deploy/counter_solana_native.so path.

@ksolana
Copy link
Contributor Author

ksolana commented Feb 18, 2024

FYI: changing the directory in package.json fixes the issue but this will not work when yarn test is invoked from the top level.

diff --git a/basics/counter/native/package.json b/basics/counter/native/package.json
index 1d59df8..bf0a8a1 100644
--- a/basics/counter/native/package.json
+++ b/basics/counter/native/package.json
@@ -7,7 +7,7 @@
   "license": "Apache-2.0",
   "private": false,
   "scripts": {
-    "start-validator": "solana-test-validator --reset --quiet --bpf-program Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS ./target/deploy/counter_solana_native.so",
+    "start-validator": "cd ../../../ && solana-test-validator --reset --quiet --bpf-program Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS ./target/deploy/counter_solana_native.so",
     "run-tests": "jest tests --detectOpenHandles",
     "test": "start-server-and-test start-validator http://localhost:8899/health run-tests"
   },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant