diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-20 17:26:15 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-20 17:26:15 -0800 |
commit | 982d3e0bc54e278991a17a857c28445ec6b5aafc (patch) | |
tree | 8a29a7573d56a18b64cb92b107a97bb6cdd7ffad /tests | |
parent | 702cf8f1e8a173a15a745c5ac3bae654c99fe33c (diff) | |
parent | f7f3ae7fce97483e9a00ea9a1bd1742f5221bb1c (diff) |
Merge pull request #1922 from coolwanglu/embed_dot_files
--exclude-file
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_other.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_other.py b/tests/test_other.py index 11a19f1c..c0f926df 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 |