do not emit temp .o files to curr dir, if target is not them; fixes #2644

This commit is contained in:
Alon Zakai 2014-08-11 12:34:15 -07:00
Родитель bff7dd6cb6
Коммит c2d449216c
2 изменённых файлов: 19 добавлений и 1 удалений

3
emcc
Просмотреть файл

@ -1447,7 +1447,8 @@ try:
return os.path.join(specified_target, os.path.basename(unsuffixed(input_file))) + default_object_extension
return specified_target
return unsuffixed(input_file) + final_ending
return unsuffixed(input_file) + default_object_extension
else:
if has_dash_c: return unsuffixed(input_file) + default_object_extension
return in_temp(unsuffixed(uniquename(input_file)) + default_object_extension)
# First, generate LLVM bitcode. For each input file, we get base.o with bitcode

Просмотреть файл

@ -1,4 +1,5 @@
import multiprocessing, os, re, shutil, subprocess, sys
import glob
import tools.shared
from tools.shared import *
from runner import RunnerCore, path_from_root, get_bullet_library, nonfastcomp
@ -3911,3 +3912,19 @@ main(const int argc, const char * const * const argv)
self.assertContained('Constructed locale "C"\nThis locale is the global locale.\nThis locale is the C locale.', run_js('a.out.js', args=['C']))
self.assertContained('''Can't construct locale "waka": collate_byname<char>::collate_byname failed to construct for waka''', run_js('a.out.js', args=['waka'], assert_returncode=1))
def test_cleanup_os(self):
# issue 2644
def test(args, be_clean):
print args
self.clear()
shutil.copyfile(path_from_root('tests', 'hello_world.c'), 'a.c')
open('b.c', 'w').write(' ')
Popen([PYTHON, EMCC, 'a.c', 'b.c'] + args).communicate()
clutter = glob.glob('*.o')
if be_clean: assert len(clutter) == 0, 'should not leave clutter ' + str(clutter)
else: assert len(clutter) == 2, 'should leave .o files'
test(['-o', 'c.bc'], True)
test(['-o', 'c.js'], True)
test(['-o', 'c.html'], True)
test(['-c'], False)