@@ -1667,6 +1667,9 @@ def test_minimal_runtime_errors(self):
16671667    err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMINIMAL_RUNTIME', '-sMINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION', '-oout.html', '-sSINGLE_FILE'])
16681668    self.assertContained('emcc: error: MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION is not compatible with SINGLE_FILE', err)
16691669
1670+     err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMINIMAL_RUNTIME', '--preload-file', 'foo'])
1671+     self.assertContained('emcc: error: MINIMAL_RUNTIME is not compatible with --preload-file', err)
1672+ 
16701673  def test_export_all_and_exported_functions(self):
16711674    # EXPORT_ALL should not export library functions by default.
16721675    # This means that to export library function you also need to explicitly
@@ -16472,3 +16475,21 @@ def test_TextDecoder_invalid(self):
1647216475
1647316476  def test_reallocarray(self):
1647416477    self.do_other_test('test_reallocarray.c')
16478+ 
16479+   def test_create_preloaded_file(self):
16480+     # Test that the FS.createPreloadedFile API works
16481+     create_file('post.js', "FS.createPreloadedFile('/', 'someotherfile.txt', 'somefile.txt', true, false);")
16482+     create_file('somefile.txt', 'hello')
16483+     create_file('main.c', r'''
16484+       #include <stdio.h>
16485+       #include <assert.h>
16486+       #include <sys/stat.h>
16487+ 
16488+       int main() {
16489+         struct stat buf;
16490+         int rtn = stat("someotherfile.txt", &buf);
16491+         assert(rtn == 0);
16492+         printf("done\n");
16493+         return 0;
16494+       }''')
16495+     self.do_runf('main.c', 'done\n', cflags=['-sFORCE_FILESYSTEM', '--post-js=post.js'])
0 commit comments