Add test and remove unused args (#951)

Followup to #930: Add a tests, and remove newly-unused arguments
to unzip and untargz.
This commit is contained in:
Sam Clegg
2021-12-22 16:21:07 -08:00
committed by GitHub
parent 8e7b714a0b
commit 4764bfa848
2 changed files with 16 additions and 14 deletions

View File

@@ -40,11 +40,11 @@ def check_call(cmd, **args):
subprocess.check_call(cmd, **args)
def checked_call_with_output(cmd, expected=None, unexpected=None, stderr=None):
def checked_call_with_output(cmd, expected=None, unexpected=None, stderr=None, env=None):
cmd = cmd.split(' ')
print('running: %s' % cmd)
try:
stdout = subprocess.check_output(cmd, stderr=stderr, universal_newlines=True)
stdout = subprocess.check_output(cmd, stderr=stderr, universal_newlines=True, env=env)
except subprocess.CalledProcessError as e:
print(e.stderr)
print(e.stdout)
@@ -272,6 +272,16 @@ int main() {
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'")
def test_keep_downloads(self):
env = os.environ.copy()
env['EMSDK_KEEP_DOWNLOADS'] = '1'
# With EMSDK_KEEP_DOWNLOADS the downloading should happen on the first
# install of 2.0.28, and again when we install 2.0.29, but not on the
# second install of 2.0.28 because the zip should already be local.
checked_call_with_output(emsdk + ' install 2.0.28', expected='Downloading:', env=env)
checked_call_with_output(emsdk + ' install 2.0.29', expected='Downloading:', env=env)
checked_call_with_output(emsdk + ' install 2.0.28', expected='already downloaded, skipping', unexpected='Downloading:', env=env)
if __name__ == '__main__':
unittest.main(verbosity=2)