diff options
-rw-r--r-- | tests/test_other.py | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/tests/test_other.py b/tests/test_other.py index 627995e9..500565d1 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -279,28 +279,33 @@ f.close() # understands Windows paths, and cygwin make additionally produces a cryptic 'not valid bitcode file' errors on files that # *are* valid bitcode files. + if WINDOWS: + generators = ['MinGW Makefiles', 'NMake Makefiles'] + else: + generators = ['Unix Makefiles'] + + make_commands = { 'MinGW Makefiles': ['mingw32-make'], 'NMake Makefiles': ['nmake', '/NOLOGO'], 'Unix Makefiles': ['make'] } + if os.name == 'nt': - make_command = 'mingw32-make' - generator = 'MinGW Makefiles' emconfigure = path_from_root('emconfigure.bat') else: - make_command = 'make' - generator = 'Unix Makefiles' emconfigure = path_from_root('emconfigure') - cmake_cases = ['target_js', 'target_html'] - cmake_outputs = ['hello_world.js', 'hello_world_gles.html'] - for i in range(0, 2): # Test both JS and HTML build outputs from CMake. - for configuration in ['Debug', 'Release']: - # CMake can be invoked in two ways, using 'emconfigure cmake', or by directly running 'cmake'. - # Test both methods. - for invoke_method in ['cmake', 'emconfigure']: - - # Create a temp workspace folder - cmakelistsdir = path_from_root('tests', 'cmake', cmake_cases[i]) - tempdirname = tempfile.mkdtemp(prefix='emscripten_test_' + self.__class__.__name__ + '_', dir=TEMP_DIR) - try: - os.chdir(tempdirname) + for generator in generators: + make = make_commands[generator] + cmake_cases = ['target_js', 'target_html'] + cmake_outputs = ['hello_world.js', 'hello_world_gles.html'] + for i in range(0, 2): + for configuration in ['Debug', 'Release']: + # CMake can be invoked in two ways, using 'emconfigure cmake', or by directly running 'cmake'. + # Test both methods. + for invoke_method in ['cmake', 'emconfigure']: + + # Create a temp workspace folder + cmakelistsdir = path_from_root('tests', 'cmake', cmake_cases[i]) + tempdirname = tempfile.mkdtemp(prefix='emscripten_test_' + self.__class__.__name__ + '_', dir=TEMP_DIR) + try: + os.chdir(tempdirname) verbose_level = int(os.getenv('EM_BUILD_VERBOSE')) if os.getenv('EM_BUILD_VERBOSE') != None else 0 @@ -323,7 +328,7 @@ f.close() assert os.path.exists(tempdirname + '/Makefile'), 'CMake call did not produce a Makefile!' # Build - cmd = [make_command] + (['VERBOSE=1'] if verbose_level >= 3 else []) + cmd = make + (['VERBOSE=1'] if verbose_level >= 3 else []) ret = Popen(cmd, stdout=None if verbose_level >= 2 else PIPE).communicate() if len(ret) > 1 and ret[1] != None and len(ret[1].strip()) > 0: logging.error(ret[1]) # If there were any errors, print them directly to console for diagnostics. @@ -333,13 +338,13 @@ f.close() raise Exception('make failed!') assert os.path.exists(tempdirname + '/' + cmake_outputs[i]), 'Building a cmake-generated Makefile failed to produce an output file %s!' % tempdirname + '/' + cmake_outputs[i] - # Run through node, if CMake produced a .js file. - if cmake_outputs[i].endswith('.js'): - ret = Popen(listify(NODE_JS) + [tempdirname + '/' + cmake_outputs[i]], stdout=PIPE).communicate()[0] - assert 'hello, world!' in ret, 'Running cmake-based .js application failed!' - finally: - os.chdir(path_from_root('tests')) # Move away from the directory we are about to remove. - shutil.rmtree(tempdirname) + # Run through node, if CMake produced a .js file. + if cmake_outputs[i].endswith('.js'): + ret = Popen(listify(NODE_JS) + [tempdirname + '/' + cmake_outputs[i]], stdout=PIPE).communicate()[0] + assert 'hello, world!' in ret, 'Running cmake-based .js application failed!' + finally: + os.chdir(path_from_root('tests')) # Move away from the directory we are about to remove. + shutil.rmtree(tempdirname) def test_failure_error_code(self): for compiler in [EMCC, EMXX]: |