aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLu Wang <coolwanglu@gmail.com>2013-12-14 19:32:06 +0800
committerLu Wang <coolwanglu@gmail.com>2013-12-14 19:32:06 +0800
commit3b572368961f87f6efbccd2929b5b00bfe814280 (patch)
treecbadc6d10b17d731f438f3f3611bf610bb725e6f /tests
parent94e1d887ffebcbf640fbca19c76331f6dffbff23 (diff)
--exclude-file
Diffstat (limited to 'tests')
-rw-r--r--tests/test_other.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_other.py b/tests/test_other.py
index b10ae13b..30546ae8 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -1347,6 +1347,32 @@ f.close()
Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp'), '--embed-file', 'tst']).communicate()
self.assertContained('|frist|\n|sacond|\n|thard|\n', run_js(os.path.join(self.get_dir(), 'a.out.js')))
+ def test_exclude_file(self):
+ try_delete(os.path.join(self.get_dir(), 'tst'))
+ os.mkdir(os.path.join(self.get_dir(), 'tst'))
+ os.mkdir(os.path.join(self.get_dir(), 'tst', 'abc.exe'))
+ os.mkdir(os.path.join(self.get_dir(), 'tst', 'abc.txt'))
+
+ open(os.path.join(self.get_dir(), 'tst', 'hello.exe'), 'w').write('''hello''')
+ open(os.path.join(self.get_dir(), 'tst', 'hello.txt'), 'w').write('''world''')
+ open(os.path.join(self.get_dir(), 'tst', 'abc.exe', 'foo'), 'w').write('''emscripten''')
+ open(os.path.join(self.get_dir(), 'tst', 'abc.txt', 'bar'), 'w').write('''!!!''')
+ open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write(r'''
+ #include <stdio.h>
+ int main() {
+ if(fopen("tst/hello.exe", "rb")) printf("Failed\n");
+ if(!fopen("tst/hello.txt", "rb")) printf("Failed\n");
+ if(fopen("tst/abc.exe/foo", "rb")) printf("Failed\n");
+ if(!fopen("tst/abc.txt/bar", "rb")) printf("Failed\n");
+
+ return 0;
+ }
+ ''')
+
+ Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp'), '--embed-file', 'tst', '--exclude-file', '*.exe']).communicate()
+ output = run_js(os.path.join(self.get_dir(), 'a.out.js'))
+ assert output == ''
+
def test_multidynamic_link(self):
# Linking the same dynamic library in will error, normally, since we statically link it, causing dupe symbols
# A workaround is to use --ignore-dynamic-linking, see emcc --help for details