Skip to content

Commit 9c0f34c

Browse files
authored
Cleanup test_exclude_file. NFC (emscripten-core#26324)
1 parent db6eee4 commit 9c0f34c

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

test/test_other.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ def test_embed_file_dup(self, args):
20632063
self.do_runf('main.c', '|frist|\n|sacond|\n|thard|\n',
20642064
cflags=['--embed-file', 'tst'] + args)
20652065

2066-
def test_exclude_file(self):
2066+
def test_embed_file_exclude(self):
20672067
ensure_dir('tst/abc.exe')
20682068
ensure_dir('tst/abc.txt')
20692069

@@ -2072,19 +2072,22 @@ def test_exclude_file(self):
20722072
create_file('tst/abc.exe/foo', 'emscripten')
20732073
create_file('tst/abc.txt/bar', '!!!')
20742074
create_file('main.c', r'''
2075+
#include <assert.h>
20752076
#include <stdio.h>
2077+
#include <unistd.h>
2078+
int exists(const char* filename) {
2079+
return access(filename, F_OK) == 0;
2080+
}
20762081
int main() {
2077-
if(fopen("tst/hello.exe", "rb")) printf("Failed\n");
2078-
if(!fopen("tst/hello.txt", "rb")) printf("Failed\n");
2079-
if(fopen("tst/abc.exe/foo", "rb")) printf("Failed\n");
2080-
if(!fopen("tst/abc.txt/bar", "rb")) printf("Failed\n");
2081-
2082+
assert(exists("tst/hello.txt"));
2083+
assert(exists("tst/abc.txt/bar"));
2084+
assert(!exists("tst/hello.exe"));
2085+
assert(!exists("tst/abc.exe/foo"));
20822086
return 0;
20832087
}
20842088
''')
20852089

2086-
self.run_process([EMCC, 'main.c', '--embed-file', 'tst', '--exclude-file', '*.exe'])
2087-
self.assertEqual(self.run_js('a.out.js').strip(), '')
2090+
self.do_runf('main.c', cflags=['--embed-file', 'tst', '--exclude-file', '*.exe'])
20882091

20892092
def test_dylink_strict(self):
20902093
self.do_run_in_out_file_test('hello_world.c', cflags=['-sSTRICT', '-sMAIN_MODULE=1'])

0 commit comments

Comments
 (0)