diff --git a/test/test_other.py b/test/test_other.py index 61db5ded23153..dd5abc6598e63 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -10766,6 +10766,22 @@ def test_html_preprocess(self): T5:ASSERTIONS T6:(else) !ASSERTIONS""", output) + def test_html_preprocess_minimal_runtime(self): + # With MINIMAL_RUNTIME it is a temporary copy of the shell file that gets + # preprocessed. Verify that ` +#if MINIMAL_RUNTIME +minimal +#endif +{{{ DOWNLOAD_JS_AND_WASM_FILES }}} +''') + self.run_process([EMCC, test_file('hello_world.c'), '-o', 'out.html', '-sMINIMAL_RUNTIME', '--shell-file', 'shell.html']) + output = read_file('out.html') + self.assertContained('\nminimal\n', output) + def test_shell_file_unused(self): create_file('foo.html', '') expected = 'emcc: error: --shell-file ignored when not generating html output [-Wunused-command-line-argument] [-Werror]' diff --git a/tools/minimal_runtime_shell.py b/tools/minimal_runtime_shell.py index 482ceb2696928..549a41ce23ec8 100644 --- a/tools/minimal_runtime_shell.py +++ b/tools/minimal_runtime_shell.py @@ -170,7 +170,7 @@ def generate_minimal_runtime_html(target, js_target, target_basename): shell = shell.replace('{{{ DOWNLOAD_JS_AND_WASM_FILES }}}', generate_minimal_runtime_load_statement(target_basename)) temp_files = shared.get_temp_files() - with temp_files.get_file(suffix='.js') as shell_temp: + with temp_files.get_file(suffix='.html') as shell_temp: utils.write_file(shell_temp, shell) shell = building.read_and_preprocess(shell_temp)