aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xemcc2
-rw-r--r--tests/runner.py9
-rw-r--r--tests/twopart_main.cpp8
-rw-r--r--tests/twopart_side.cpp8
4 files changed, 22 insertions, 5 deletions
diff --git a/emcc b/emcc
index 89a6bdf8..db3d58ac 100755
--- a/emcc
+++ b/emcc
@@ -309,7 +309,7 @@ if not header:
shutil.move(unsuffixed_basename(input_file) + '.o', unsuffixed_basename(input_file) + '.bc')
if specified_target:
- assert len(input_files) == 1, 'If a target is specified, and we are compiling to bitcode, there should be exactly one input file (c.f. gcc for why)'
+ assert len(input_files) == 1, 'fatal error: cannot specify -o with -c with multiple files'
shutil.move(unsuffixed_basename(input_files[0]) + '.' + final_suffix, unsuffixed_basename(specified_target) + '.' + final_suffix)
exit(0)
diff --git a/tests/runner.py b/tests/runner.py
index 8154be8b..5a836961 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -4961,7 +4961,7 @@ Options that are modified or new in %s include:
self.assertContained('hello, world!', run_js('a.out.js'))
assert test(open('a.out.js').read()), text
- '''# Compiling two source files into a final JS.
+ # Compiling two source files into a final JS.
for args, target in [([], 'a.out.js'), (['-o', 'combined.js'], 'combined.js')]:
clear()
output = Popen([compiler, path_from_root('tests', 'twopart_main.cpp'), path_from_root('tests', 'twopart_side.cpp')] + args,
@@ -4972,7 +4972,7 @@ Options that are modified or new in %s include:
# Compiling two files with -c will generate separate .bc files
clear()
- output = Popen([compiler, path_from_root('tests', 'twopart_main.cpp'), path_from_root('tests', 'twopart_side.cpp'), '-c'],
+ output = Popen([compiler, path_from_root('tests', 'twopart_main.cpp'), path_from_root('tests', 'twopart_side.cpp'), '-c'] + args,
stdout=PIPE, stderr=PIPE).communicate()
if '-o' in args:
# specifying -o and -c is an error
@@ -4987,12 +4987,13 @@ Options that are modified or new in %s include:
output = Popen([compiler, 'twopart_main.bc'] + args, stdout=PIPE, stderr=PIPE).communicate()
assert os.path.exists(target), '\n'.join(output)
#print '\n'.join(output)
- self.assertContained('theFunc is undefined', run_js(target))
+ self.assertContained('is not a function', run_js(target, stderr=STDOUT))
+ try_delete(target)
# Combining those bc files into js should work
output = Popen([compiler, 'twopart_main.bc', 'twopart_side.bc'] + args, stdout=PIPE, stderr=PIPE).communicate()
assert os.path.exists(target), '\n'.join(output)
- self.assertContained('side got: hello from main, over', run_js(target))'''
+ self.assertContained('side got: hello from main, over', run_js(target))
# linking - TODO. in particular, test normal project linking, static and dynamic: get_library should not need to be told what to link!
diff --git a/tests/twopart_main.cpp b/tests/twopart_main.cpp
new file mode 100644
index 00000000..6fac53c6
--- /dev/null
+++ b/tests/twopart_main.cpp
@@ -0,0 +1,8 @@
+
+extern void theFunc(char *str);
+
+int main() {
+ theFunc("hello from main");
+ return 1;
+}
+
diff --git a/tests/twopart_side.cpp b/tests/twopart_side.cpp
new file mode 100644
index 00000000..f6cb92b8
--- /dev/null
+++ b/tests/twopart_side.cpp
@@ -0,0 +1,8 @@
+
+#include<stdio.h>
+
+void theFunc(char *str)
+{
+ printf("side got: %s, over\n", str);
+}
+