diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-04-07 20:42:02 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-04-07 20:42:02 -0700 |
commit | ae1cb6d7eca0bffcfae0f923dd2dd6d7ed8037ca (patch) | |
tree | a3ab3df08a53fc41f93d42aac748670c2355067c /tests/runner.py | |
parent | 7af9a2d81c1c3fe1711c1d6a9b702aaab44ef67a (diff) |
handle identical basenames in emcc properly; fixes #287
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-x | tests/runner.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index 7479aaf0..03ec803f 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -6366,6 +6366,39 @@ f.close() Popen(['python', EMCC, os.path.join(self.get_dir(), 'main.cpp'), os.path.join(self.get_dir(), 'subdir', 'libfile.so'), '-L.']).communicate() self.assertContained('hello from lib', run_js(os.path.join(self.get_dir(), 'a.out.js'))) + def test_identical_basenames(self): + # Issue 287: files in different dirs but with the same basename get confused as the same, + # causing multiply defined symbol errors + try: + os.makedirs(os.path.join(self.get_dir(), 'foo')); + except: + pass + try: + os.makedirs(os.path.join(self.get_dir(), 'bar')); + except: + pass + open(os.path.join(self.get_dir(), 'foo', 'main.cpp'), 'w').write(''' + extern void printey(); + int main() { + printey(); + return 0; + } + ''') + open(os.path.join(self.get_dir(), 'bar', 'main.cpp'), 'w').write(''' + #include<stdio.h> + void printey() { printf("hello there\\n"); } + ''') + + Popen(['python', EMCC, os.path.join(self.get_dir(), 'foo', 'main.cpp'), os.path.join(self.get_dir(), 'bar', 'main.cpp')]).communicate() + self.assertContained('hello there', run_js(os.path.join(self.get_dir(), 'a.out.js'))) + + # ditto with first creating .o files + try_delete(os.path.join(self.get_dir(), 'a.out.js')) + Popen(['python', EMCC, os.path.join(self.get_dir(), 'foo', 'main.cpp'), '-o', os.path.join(self.get_dir(), 'foo', 'main.o')]).communicate() + Popen(['python', EMCC, os.path.join(self.get_dir(), 'bar', 'main.cpp'), '-o', os.path.join(self.get_dir(), 'bar', 'main.o')]).communicate() + Popen(['python', EMCC, os.path.join(self.get_dir(), 'foo', 'main.o'), os.path.join(self.get_dir(), 'bar', 'main.o')]).communicate() + self.assertContained('hello there', run_js(os.path.join(self.get_dir(), 'a.out.js'))) + def test_embed_file(self): open(os.path.join(self.get_dir(), 'somefile.txt'), 'w').write('''hello from a file with lots of data and stuff in it thank you very much''') open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write(r''' |