Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion emar.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@

from tools import shared

shared.exec_process([shared.LLVM_AR] + sys.argv[1:])
shared.exec_process([shared.paths.LLVM_AR] + sys.argv[1:])
10 changes: 5 additions & 5 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from tools.cmdline import CLANG_FLAGS_WITH_ARGS, options
from tools.response_file import substitute_response_files
from tools.settings import COMPILE_TIME_SETTINGS, default_setting, settings, user_settings
from tools.shared import DEBUG, DYLIB_EXTENSIONS, in_temp
from tools.shared import DEBUG, DYLIB_EXTENSIONS, in_temp, paths
from tools.toolchain_profiler import ToolchainProfiler
from tools.utils import exit_with_error, get_file_suffix, read_file, unsuffixed_basename

Expand Down Expand Up @@ -168,9 +168,9 @@ def make_relative(filename):
@ToolchainProfiler.profile()
def main(args):
if shared.run_via_emxx:
clang = shared.CLANG_CXX
clang = paths.CLANG_CXX
else:
clang = shared.CLANG_CC
clang = paths.CLANG_CC

# Special case the handling of `-v` because it has a special/different meaning
# when used with no other arguments. In particular, we must handle this early
Expand Down Expand Up @@ -477,9 +477,9 @@ def phase_setup(state):
@ToolchainProfiler.profile_block('compile inputs')
def phase_compile_inputs(options, state, newargs):
if shared.run_via_emxx:
compiler = [shared.CLANG_CXX]
compiler = [paths.CLANG_CXX]
else:
compiler = [shared.CLANG_CC]
compiler = [paths.CLANG_CC]

if config.COMPILER_WRAPPER:
logger.debug('using compiler wrapper: %s', config.COMPILER_WRAPPER)
Expand Down
2 changes: 1 addition & 1 deletion emranlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

from tools import shared

shared.exec_process([shared.LLVM_RANLIB] + sys.argv[1:])
shared.exec_process([shared.paths.LLVM_RANLIB] + sys.argv[1:])
2 changes: 1 addition & 1 deletion emstrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@

from tools import shared

shared.exec_process([shared.LLVM_STRIP] + sys.argv[1:])
shared.exec_process([shared.paths.LLVM_STRIP] + sys.argv[1:])
4 changes: 2 additions & 2 deletions test/browser_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

from tools import feature_matrix, shared, utils
from tools.feature_matrix import UNSUPPORTED
from tools.shared import DEBUG, EMCC, exit_with_error
from tools.shared import DEBUG, exit_with_error, paths
from tools.utils import MACOS, WINDOWS, memoize, path_from_root, read_binary

logger = logging.getLogger('common')
Expand Down Expand Up @@ -878,7 +878,7 @@ def compile_btest(self, filename, cflags, reporting=Reporting.FULL):
if reporting == Reporting.FULL:
# If C reporting (i.e. the REPORT_RESULT macro) is required we
# also include report_result.c and force-include report_result.h
self.run_process([EMCC, '-c', '-I' + TEST_ROOT,
self.run_process([paths.EMCC, '-c', '-I' + TEST_ROOT,
test_file('report_result.c')] + self.get_cflags(compile_only=True) + (['-fPIC'] if '-fPIC' in cflags else []))
cflags += ['report_result.o', '-include', test_file('report_result.h')]
if EMTEST_BROWSER == 'node':
Expand Down
8 changes: 4 additions & 4 deletions test/clang_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import platform
import sys

from tools.shared import CLANG_CC, CLANG_CXX, PIPE
from tools.shared import PIPE, paths
from tools.utils import MACOS, WINDOWS, path_from_root, run_process

logger = logging.getLogger('clang_native')
Expand Down Expand Up @@ -63,9 +63,9 @@ def get_clang_native_env():
return CACHED_CLANG_NATIVE_ENV
env = os.environ.copy()

env['CC'] = CLANG_CC
env['CXX'] = CLANG_CXX
env['LD'] = CLANG_CXX
env['CC'] = paths.CLANG_CC
env['CXX'] = paths.CLANG_CXX
env['LD'] = paths.CLANG_CXX

if MACOS:
path = run_process(['xcrun', '--show-sdk-path'], stdout=PIPE).stdout.strip()
Expand Down
8 changes: 4 additions & 4 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from tools import building, config, feature_matrix, shared, utils
from tools.feature_matrix import Feature
from tools.settings import COMPILE_TIME_SETTINGS
from tools.shared import DEBUG, EMCC, EMXX, get_canonical_temp_dir
from tools.shared import DEBUG, get_canonical_temp_dir, paths
from tools.utils import (
WINDOWS,
exit_with_error,
Expand Down Expand Up @@ -130,9 +130,9 @@ def copytree(src, dest):

def compiler_for(filename, force_c=False):
if utils.suffix(filename) in ('.cc', '.cxx', '.cpp') and not force_c:
return EMXX
return paths.EMXX
else:
return EMCC
return paths.EMCC


def record_flaky_test(test_name, attempt_count, max_attempts, exception_msg):
Expand Down Expand Up @@ -1272,7 +1272,7 @@ def _test_dylink_dso_needed(self, do_run):
''')

def ccshared(src, linkto=None):
cmdv = [EMCC, src, '-o', utils.unsuffixed(src) + '.wasm', '-sSIDE_MODULE'] + self.get_cflags()
cmdv = [paths.EMCC, src, '-o', utils.unsuffixed(src) + '.wasm', '-sSIDE_MODULE'] + self.get_cflags()
if linkto:
cmdv += linkto
self.run_process(cmdv)
Expand Down
6 changes: 3 additions & 3 deletions test/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from decorators import needs_make

from tools import building, utils
from tools.shared import CLANG_CC, CLANG_CXX, EMCC, PIPE, config
from tools.shared import PIPE, config, paths
from tools.utils import run_process

# standard arguments for timing:
Expand Down Expand Up @@ -232,7 +232,7 @@ def build(self, parent, filename, args, shared_args, emcc_args, native_args, nat
final = final.replace('.cpp', '')
utils.delete_file(final)
cmd = [
EMCC, filename,
paths.EMCC, filename,
OPTIMIZATIONS,
'-sINITIAL_MEMORY=256MB',
'-sENVIRONMENT=node,shell',
Expand Down Expand Up @@ -361,7 +361,7 @@ def get_output_files(self):
aot_v8 = (config.V8_ENGINE if config.V8_ENGINE else []) + ['--no-liftoff']

named_benchmarkers = {
'clang': NativeBenchmarker('clang', [CLANG_CC], [CLANG_CXX]),
'clang': NativeBenchmarker('clang', [paths.CLANG_CC], [paths.CLANG_CXX]),
'gcc': NativeBenchmarker('gcc', ['gcc', '-no-pie'], ['g++', '-no-pie']),
'size': SizeBenchmarker('size'),
'v8': EmscriptenBenchmarker('v8', aot_v8),
Expand Down
5 changes: 4 additions & 1 deletion test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@

from tools import ports, shared
from tools.feature_matrix import Feature
from tools.shared import EMCC, FILE_PACKAGER, PIPE
from tools.shared import PIPE, paths
from tools.utils import WINDOWS, delete_dir

EMCC = paths.EMCC
FILE_PACKAGER = paths.FILE_PACKAGER


def make_test_chunked_synchronous_xhr_server(support_byte_ranges, data, port):
class ChunkedServerHandler(BaseHTTPRequestHandler):
Expand Down
34 changes: 18 additions & 16 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
)

from tools import building, config, shared, utils, webassembly
from tools.shared import EMAR, EMCC, EMXX, FILE_PACKAGER, LLVM_COV, LLVM_PROFDATA, PIPE
from tools.shared import PIPE, paths
from tools.utils import LINUX, MACOS, WINDOWS, delete_file, write_file

# decorators for limiting which modes a test can run in
Expand All @@ -82,6 +82,10 @@
EM_SIGINT = 2
EM_SIGABRT = 6

EMAR = paths.EMAR
EMCC = paths.EMCC
EMXX = paths.EMXX


def esm_integration(func):
assert callable(func)
Expand Down Expand Up @@ -6599,7 +6603,7 @@ def test_neon_wasm_simd(self):
@no_big_endian('SIMD support is currently not compatible with big endian')
def test_sse1(self, args):
src = test_file('sse/test_sse1.cpp')
self.run_process([shared.CLANG_CXX, src, '-msse', '-o', 'test_sse1', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
self.run_process([paths.CLANG_CXX, src, '-msse', '-o', 'test_sse1', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
native_result = self.run_process('./test_sse1', stdout=PIPE).stdout

self.maybe_closure()
Expand All @@ -6620,7 +6624,7 @@ def test_sse1(self, args):
@no_big_endian('SIMD support is currently not compatible with big endian')
def test_sse2(self, args):
src = test_file('sse/test_sse2.cpp')
self.run_process([shared.CLANG_CXX, src, '-msse2', '-Wno-argument-outside-range', '-o', 'test_sse2', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
self.run_process([paths.CLANG_CXX, src, '-msse2', '-Wno-argument-outside-range', '-o', 'test_sse2', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
native_result = self.run_process('./test_sse2', stdout=PIPE).stdout

self.cflags += ['-I' + test_file('sse'), '-msse2', '-fno-inline-functions', '-Wno-argument-outside-range', '-sSTACK_SIZE=1MB'] + args
Expand All @@ -6634,7 +6638,7 @@ def test_sse2(self, args):
@no_big_endian('SIMD support is currently not compatible with big endian')
def test_sse3(self):
src = test_file('sse/test_sse3.cpp')
self.run_process([shared.CLANG_CXX, src, '-msse3', '-Wno-argument-outside-range', '-o', 'test_sse3', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
self.run_process([paths.CLANG_CXX, src, '-msse3', '-Wno-argument-outside-range', '-o', 'test_sse3', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
native_result = self.run_process('./test_sse3', stdout=PIPE).stdout

self.cflags += ['-I' + test_file('sse'), '-msse3', '-Wno-argument-outside-range']
Expand All @@ -6648,7 +6652,7 @@ def test_sse3(self):
@no_big_endian('SIMD support is currently not compatible with big endian')
def test_ssse3(self):
src = test_file('sse/test_ssse3.cpp')
self.run_process([shared.CLANG_CXX, src, '-mssse3', '-Wno-argument-outside-range', '-o', 'test_ssse3', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
self.run_process([paths.CLANG_CXX, src, '-mssse3', '-Wno-argument-outside-range', '-o', 'test_ssse3', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
native_result = self.run_process('./test_ssse3', stdout=PIPE).stdout

self.cflags += ['-I' + test_file('sse'), '-mssse3', '-Wno-argument-outside-range']
Expand All @@ -6665,7 +6669,7 @@ def test_ssse3(self):
def test_sse4_1(self):
src = test_file('sse/test_sse4_1.cpp')
# Run with inlining disabled to avoid slow LLVM behavior with lots of macro expanded loops inside a function body.
self.run_process([shared.CLANG_CXX, src, '-msse4.1', '-fno-inline-functions', '-Wno-argument-outside-range', '-o', 'test_sse4_1', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
self.run_process([paths.CLANG_CXX, src, '-msse4.1', '-fno-inline-functions', '-Wno-argument-outside-range', '-o', 'test_sse4_1', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
native_result = self.run_process('./test_sse4_1', stdout=PIPE).stdout

self.cflags += ['-I' + test_file('sse'), '-msse4.1', '-fno-inline-functions', '-Wno-argument-outside-range', '-sSTACK_SIZE=1MB']
Expand All @@ -6684,7 +6688,7 @@ def test_sse4_1(self):
def test_sse4(self, use_4_2):
msse4 = '-msse4.2' if use_4_2 else '-msse4'
src = test_file('sse/test_sse4_2.cpp')
self.run_process([shared.CLANG_CXX, src, msse4, '-Wno-argument-outside-range', '-o', 'test_sse4_2', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
self.run_process([paths.CLANG_CXX, src, msse4, '-Wno-argument-outside-range', '-o', 'test_sse4_2', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
native_result = self.run_process('./test_sse4_2', stdout=PIPE).stdout

self.cflags += ['-I' + test_file('sse'), msse4, '-Wno-argument-outside-range']
Expand All @@ -6705,7 +6709,7 @@ def test_sse4(self, use_4_2):
@no_big_endian('SIMD support is currently not compatible with big endian')
def test_avx(self, args):
src = test_file('sse/test_avx.cpp')
self.run_process([shared.CLANG_CXX, src, '-mavx', '-Wno-argument-outside-range', '-Wpedantic', '-o', 'test_avx', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
self.run_process([paths.CLANG_CXX, src, '-mavx', '-Wno-argument-outside-range', '-Wpedantic', '-o', 'test_avx', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
native_result = self.run_process('./test_avx', stdout=PIPE).stdout

self.cflags += ['-I' + test_file('sse'), '-mavx', '-fno-inline-functions', '-Wno-argument-outside-range', '-sSTACK_SIZE=1MB'] + args
Expand All @@ -6726,7 +6730,7 @@ def test_avx(self, args):
@no_big_endian('SIMD support is currently not compatible with big endian')
def test_avx2(self, args):
src = test_file('sse/test_avx2.cpp')
self.run_process([shared.CLANG_CXX, src, '-mavx2', '-Wno-argument-outside-range', '-Wpedantic', '-o', 'test_avx2', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
self.run_process([paths.CLANG_CXX, src, '-mavx2', '-Wno-argument-outside-range', '-Wpedantic', '-o', 'test_avx2', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
native_result = self.run_process('./test_avx2', stdout=PIPE).stdout

self.cflags += ['-I' + test_file('sse'), '-mavx2', '-Wno-argument-outside-range', '-sSTACK_SIZE=1MB'] + args
Expand All @@ -6738,9 +6742,7 @@ def test_sse_diagnostics(self):
self.cflags.remove('-Werror')
src = test_file('sse/test_sse_diagnostic.cpp')

p = self.run_process(
[shared.EMXX, src, '-msse', '-DWASM_SIMD_COMPAT_SLOW'] + self.get_cflags(),
stderr=PIPE)
p = self.run_process([paths.EMXX, src, '-msse', '-DWASM_SIMD_COMPAT_SLOW'] + self.get_cflags(), stderr=PIPE)
self.assertContained('Instruction emulated via slow path.', p.stderr)

@wasm_relaxed_simd
Expand Down Expand Up @@ -7960,7 +7962,7 @@ def test_dwarf(self):

self.emcc('test_dwarf.c')

out = self.run_process([shared.LLVM_DWARFDUMP, 'a.out.wasm', '-all'], stdout=PIPE).stdout
out = self.run_process([paths.LLVM_DWARFDUMP, 'a.out.wasm', '-all'], stdout=PIPE).stdout

# parse the sections
sections = {}
Expand Down Expand Up @@ -9680,7 +9682,7 @@ def test_emscripten_async_load_script(self):
create_file('file2.txt', 'second')
# `--from-emcc` needed here otherwise the output defines `var Module =` which will shadow the
# global `Module`.
self.run_process([FILE_PACKAGER, 'test.data', '--preload', 'file1.txt', 'file2.txt', '--from-emcc', '--js-output=script2.js'])
self.run_process([paths.FILE_PACKAGER, 'test.data', '--preload', 'file1.txt', 'file2.txt', '--from-emcc', '--js-output=script2.js'])
self.do_runf('test_emscripten_async_load_script.c', cflags=['-sFORCE_FILESYSTEM'])

@node_pthreads
Expand Down Expand Up @@ -9820,9 +9822,9 @@ def test_fcoverage_mapping(self):
self.set_setting('EXIT_RUNTIME')
self.do_core_test('test_hello_world.c', cflags=['-fprofile-instr-generate', '-fcoverage-mapping', '-g'])
self.assertExists('default.profraw')
self.run_process([LLVM_PROFDATA, 'merge', '-sparse', 'default.profraw', '-o', 'out.profdata'])
self.run_process([paths.LLVM_PROFDATA, 'merge', '-sparse', 'default.profraw', '-o', 'out.profdata'])
self.assertExists('out.profdata')
self.assertEqual(expected, self.run_process([LLVM_COV, 'show', 'test_hello_world.wasm', '-instr-profile=out.profdata'], stdout=PIPE).stdout)
self.assertEqual(expected, self.run_process([paths.LLVM_COV, 'show', 'test_hello_world.wasm', '-instr-profile=out.profdata'], stdout=PIPE).stdout)

# Generate tests for everything
def make_run(name, cflags=None, settings=None, env=None, # noqa
Expand Down
4 changes: 3 additions & 1 deletion test/test_jslib.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
from common import RunnerCore, create_file, read_file, test_file
from decorators import parameterized

from tools.shared import EMCC
from tools.shared import paths
from tools.utils import delete_file

EMCC = paths.EMCC


class jslib(RunnerCore):
def test_jslib_no_override(self):
Expand Down
37 changes: 18 additions & 19 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,7 @@
from tools.building import get_building_env
from tools.link import binary_encode
from tools.settings import settings
from tools.shared import (
CLANG_CC,
CLANG_CXX,
EMAR,
EMCC,
EMRANLIB,
EMXX,
FILE_PACKAGER,
LLVM_AR,
LLVM_DWARFDUMP,
LLVM_DWP,
LLVM_NM,
WASM_LD,
config,
)
from tools.shared import config, paths
from tools.system_libs import DETERMINISTIC_PREFIX
from tools.utils import (
MACOS,
Expand All @@ -126,6 +112,19 @@
emstrip = utils.bat_suffix(path_from_root('emstrip'))
emsymbolizer = utils.bat_suffix(path_from_root('emsymbolizer'))

CLANG_CC = paths.CLANG_CC
CLANG_CXX = paths.CLANG_CXX
EMAR = paths.EMAR
EMCC = paths.EMCC
EMRANLIB = paths.EMRANLIB
EMXX = paths.EMXX
FILE_PACKAGER = paths.FILE_PACKAGER
LLVM_AR = paths.LLVM_AR
LLVM_DWARFDUMP = paths.LLVM_DWARFDUMP
LLVM_DWP = paths.LLVM_DWP
LLVM_NM = paths.LLVM_NM
WASM_LD = paths.WASM_LD


def is_bitcode(filename):
try:
Expand Down Expand Up @@ -6291,7 +6290,7 @@ def check(what, args, fail=True, expect=''):
import os
print(os.environ.get('NM'))
''')
check(EMCONFIGURE, [PYTHON, 'test.py'], expect=shared.LLVM_NM, fail=False)
check(EMCONFIGURE, [PYTHON, 'test.py'], expect=LLVM_NM, fail=False)

create_file('test.c', 'int main() { return 0; }')
os.mkdir('test_cache')
Expand Down Expand Up @@ -11532,12 +11531,12 @@ def test_emranlib(self):

# Create a library with no archive map
self.run_process([EMAR, 'crS', 'liba.a', 'foo.o', 'bar.o'])
output = self.run_process([shared.LLVM_NM, '--print-armap', 'liba.a'], stdout=PIPE).stdout
output = self.run_process([LLVM_NM, '--print-armap', 'liba.a'], stdout=PIPE).stdout
self.assertNotContained('Archive map', output)

# Add an archive map
self.run_process([EMRANLIB, 'liba.a'])
output = self.run_process([shared.LLVM_NM, '--print-armap', 'liba.a'], stdout=PIPE).stdout
output = self.run_process([LLVM_NM, '--print-armap', 'liba.a'], stdout=PIPE).stdout
self.assertContained('Archive map', output)

def test_pthread_stub(self):
Expand Down Expand Up @@ -12016,7 +12015,7 @@ def test_missing_malloc_export(self):
def test_getrusage(self):
self.do_other_test('test_getrusage.c')

@with_env_modify({'EMMAKEN_COMPILER': shared.CLANG_CC})
@with_env_modify({'EMMAKEN_COMPILER': CLANG_CC})
def test_emmaken_compiler(self):
self.assert_fail([EMCC, '-c', test_file('core/test_hello_world.c')], 'emcc: error: `EMMAKEN_COMPILER` is no longer supported')

Expand Down
3 changes: 2 additions & 1 deletion test/test_sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@

from tools import cache, ports, response_file, shared, utils
from tools.config import EM_CONFIG
from tools.shared import EMCC, config
from tools.shared import config, paths
from tools.utils import delete_dir, delete_file

SANITY_FILE = cache.get_path('sanity.txt')
EMCC = paths.EMCC
commands = [[EMCC], [shared.bat_suffix(path_from_root('test/runner')), 'blahblah']]
expected_llvm_version = str(shared.EXPECTED_LLVM_VERSION) + '.0.0'

Expand Down
Loading
Loading