Error out on attempt to activate a missing tools (#838)

Previously if a tool (any part of an SDK) was not installed
we would issue a warning and continue to active without returning
non-zero.

This meant doing `emsdk install 2.0.0 && emsdk activate latest`
would appear to be work aside from the warning messages about
latest not being installed.

This is especially annoying since we dropped support for side
by side SDK installations.  The following sequence is no longer
valid and we want to make that clear by erroring out:

```
$ emsdk install 2.0.1
$ emsdk install 2.0.2
$ emsdk activate 2.0.1
```

Since 2.0.2 replaces 2.0.1 on the filesystem the active here
could fail hard rather than just warning.
This commit is contained in:
Sam Clegg
2021-06-15 22:19:47 -07:00
committed by GitHub
parent e2dc11e0db
commit c341e544a7
2 changed files with 9 additions and 16 deletions

View File

@@ -64,8 +64,8 @@ def failing_call_with_output(cmd, expected):
if WINDOWS:
print('warning: skipping part of failing_call_with_output() due to error codes not being propagated (see #592)')
else:
assert proc.returncode, 'call must have failed: ' + str([stdout, "\n========\n", stderr])
assert expected in stdout or expected in stderr, 'call did not have the right output'
assert proc.returncode, 'call must have failed: ' + str([stdout, '\n========\n', stderr])
assert expected in stdout or expected in stderr, 'call did not have the right output: ' + str([stdout, '\n========\n', stderr])
def hack_emsdk(marker, replacement):
@@ -262,6 +262,10 @@ int main() {
# Test that its possible to install emscripten as tool instead of SDK
checked_call_with_output(emsdk + ' install releases-upstream-77b065ace39e6ab21446e13f92897f956c80476a', unexpected='Installing SDK')
def test_activate_missing(self):
run_emsdk('install latest')
failing_call_with_output(emsdk + ' activate 2.0.1', expected="error: tool is not installed and therefore cannot be activated: 'releases-upstream-13e29bd55185e3c12802bc090b4507901856b2ba-64bit'")
if __name__ == '__main__':
unittest.main(verbosity=2)