aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-12-25 21:31:18 +0200
committerJukka Jylänki <jujjyl@gmail.com>2013-12-29 11:04:23 +0200
commit480fa4d6ea2a996ff57569dab12f4d46c221f01f (patch)
tree1451b9261f4c0a135b04551ec38692935ffb000d /tests
parent8178ecd4a7301f2971254707e8f379f9ed91cc3e (diff)
Define behavior that 'emcc -c a.c -o dir/' shall compile and generate object file 'dir/a.o'. Previous behavior when directory was specified in -o was accidental, and it generated an object file 'dir/a_0.o'. Add new command line option --default-obj-ext that allows specifying the file suffix that is used when the output object filename is generated in this manner. '.o' is a good default suffix since it parallels the existing gcc/clang/linux convention. For Windows Visual Studio+CMake+Emscripten integration, CMake has been hardcoded to assume that if Visual Studio is targeted, the compiler will always generate '.obj' files. Hence having the ability to adjust the default naming scheme with --default-obj-ext enables working around CMake inflexibility, and add support for CMake+VS+Emscripten triple.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_other.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_other.py b/tests/test_other.py
index 0c325c74..eb9bd23d 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -2187,3 +2187,12 @@ mergeInto(LibraryManager.library, {
out, err = process.communicate()
assert process.returncode is 0, 'float.h should agree with our system: ' + out + '\n\n\n' + err
+ def test_default_obj_ext(self):
+ outdir = os.path.join(self.get_dir(), 'out_dir') + '/'
+ os.mkdir(outdir)
+ process = Popen([PYTHON, EMCC, '-c', path_from_root('tests', 'hello_world.c'), '-o', outdir], stdout=PIPE, stderr=PIPE)
+ process.communicate()
+ assert(os.path.isfile(outdir + 'hello_world.o'))
+ process = Popen([PYTHON, EMCC, '-c', path_from_root('tests', 'hello_world.c'), '-o', outdir, '--default-obj-ext', 'obj'], stdout=PIPE, stderr=PIPE)
+ process.communicate()
+ assert(os.path.isfile(outdir + 'hello_world.obj'))