I have a bunch of pre-existing tests and benchmarks written in vanilla C++ that load images (png, jpeg, etc) from the local filesystem as part of their normal operation. I'm now cross-compiling them into wasm using emscripten, and running them in a wasm-enabled shell (d8 or Node); what options do I have that will minimize the amount of editing I need to do to each test?
Based on what I've read so far:
- I could modify my Makefiles to use --embed_file when building each test. Pro: the tests can work without editing the C++ source. Con: build time is extremely slow; doesn't allow any test outputs or byproducts to be easily written to local filesystem (e.g for debugging)
- If I require Node instead of d8, I could use FS.mount(NODEFS) to map the local filesystem in a way that the wasm code can see. Pros: actually provides file access and file output. Cons: requires adding awkward boilerplate to every test I want to run in this environment; requires Node rather than d8
Are there other options I'm missing? (Fortunately, running these tests in a browser environment isn't yet a requirement, though it may be eventually.)
(A close-enough-to-ideal solution for me would be if Node allowed some commandline / config setup that did the filesystem mapping automatically; if such a thing exists, I haven't found it, but I am a newcomer to Node so could have easily missed it.)