Compiletest doesn't pass environment variables to emscripten tests

c584bfe
Opened by Pierre Krieger at 2024-10-11 06:39:28

Compiletest sometimes passes environment variables when building the Command object. However in the case of emscripten, these values get passed to node instead of the program itself.

node can't propagate env vars to the javascript code, since javascript has no concept of an environment variable. It is possible to pass environment variables to the "emscripten runtime", but that must be done by manually adding some JS code in the header of the file.

For the moment the tests that rely on env vars are ignored and point to this issue.

  1. node can't propagate env vars to the javascript code, since javascript has no concept of an environment variable.

    Not sure what this means. Node.js scripts surely have access to environment variables via process.env.

    Ingvar Stepanyan at 2017-02-13 11:19:00

  2. The problem is that the Rust code doesn't retreive environment variables with process.env but with the getenv function provided by Emscripten.

    If emscripten were to call process.env to fill environment variables then it would work, but I'm not sure it does. I follow the path until here and here but I can't find what calls __libc_start_main or dynlink.

    Pierre Krieger at 2017-02-13 11:58:53

  3. @tomaka Sounds like https://github.com/kripken/emscripten/issues/3915 (which is to be fixed in https://github.com/kripken/emscripten/pull/3948).

    Ingvar Stepanyan at 2017-02-13 12:07:49