Skip to content
Merged
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
11 changes: 0 additions & 11 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,6 @@ def make_relative(filename):
reproduce_file.add(rsp_name, os.path.join(root, 'response.txt'))


def get_library_basename(filename):
"""Similar to get_file_suffix this strips off all numeric suffixes and then
then final non-numeric one. For example for 'libz.so.1.2.8' returns 'libz'"""
filename = os.path.basename(filename)
while filename:
filename, suffix = os.path.splitext(filename)
# Keep stipping suffixes until we strip a non-numeric one.
if not suffix[1:].isdigit():
return filename


#
# Main run() function
#
Expand Down
4 changes: 2 additions & 2 deletions emrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,9 @@ def shutdown(self):

# Processes HTTP request back to the browser.
class HTTPHandler(SimpleHTTPRequestHandler):
protocol_version = 'HTTP/1.1'

def send_head(self):
self.protocol_version = 'HTTP/1.1'
global page_last_served_time
path = self.translate_path(self.path)
f = None
Expand Down Expand Up @@ -669,7 +670,6 @@ def log_message(self, format, *args):
sys.stderr.write(msg)

def do_POST(self):
self.protocol_version = 'HTTP/1.1'
global page_exit_code, have_received_messages

(_, _, path, query, _) = urlsplit(self.path)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ module = ["psutil", "win32con", "win32gui", "win32process"]
ignore_missing_imports = true

[tool.deadcode]
exclude = ["out", "third_party", "test/third_party"]
exclude = ["out", "third_party", "test/third_party", "node_modules", "site/source/_themes", "site/source/conf.py"]
62 changes: 0 additions & 62 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,17 +414,6 @@ def decorated(self, *args, **kwargs):
return decorated


def requires_wasm_legacy_eh(func):
assert callable(func)

@wraps(func)
def decorated(self, *args, **kwargs):
self.require_wasm_legacy_eh()
return func(self, *args, **kwargs)

return decorated


def requires_wasm_eh(func):
assert callable(func)

Expand Down Expand Up @@ -632,31 +621,6 @@ def metafunc(self, rawfs, *args, **kwargs):
return metafunc


# Decorator version of env_modify
def also_with_env_modify(name_updates_mapping):

def decorated(f):
@wraps(f)
def metafunc(self, updates, *args, **kwargs):
if DEBUG:
print('parameterize:env_modify=%s' % (updates))
if updates:
with env_modify(updates):
return f(self, *args, **kwargs)
else:
return f(self, *args, **kwargs)

params = {'': (None,)}
for name, updates in name_updates_mapping.items():
params[name] = (updates,)

parameterize(metafunc, params)

return metafunc

return decorated


def also_with_minimal_runtime(f):
assert callable(f)

Expand Down Expand Up @@ -1638,32 +1602,6 @@ def get_func(self, src, name):
t += 1
assert t < len(src)

def count_funcs(self, javascript_file):
num_funcs = 0
start_tok = "// EMSCRIPTEN_START_FUNCS"
end_tok = "// EMSCRIPTEN_END_FUNCS"
start_off = 0
end_off = 0

js = read_file(javascript_file)
blob = "".join(js.splitlines())

start_off = blob.find(start_tok) + len(start_tok)
end_off = blob.find(end_tok)
asm_chunk = blob[start_off:end_off]
num_funcs = asm_chunk.count('function ')
return num_funcs

def count_wasm_contents(self, wasm_binary, what):
out = self.run_process([os.path.join(building.get_binaryen_bin(), 'wasm-opt'), wasm_binary, '--metrics'], stdout=PIPE).stdout
# output is something like
# [?] : 125
for line in out.splitlines():
if '[' + what + ']' in line:
ret = line.split(':')[1].strip()
return int(ret)
self.fail('Failed to find [%s] in wasm-opt output' % what)

def get_wasm_text(self, wasm_binary):
return self.run_process([WASM_DIS, wasm_binary], stdout=PIPE).stdout

Expand Down
4 changes: 2 additions & 2 deletions test/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def check_js_engines():
def get_and_import_modules():
modules = []
for filename in glob.glob(os.path.join(common.TEST_ROOT, 'test*.py')):
module_dir, module_file = os.path.split(filename)
module_name, module_ext = os.path.splitext(module_file)
module_file = os.path.basename(filename)
module_name = os.path.splitext(module_file)[0]
__import__(module_name)
modules.append(sys.modules[module_name])
return modules
Expand Down
5 changes: 0 additions & 5 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3775,11 +3775,6 @@ def zzztest_dlfcn_exceptions(self):
@no_js_math('JS_MATH is not compatible with MAIN_MODULE')
def test_dlfcn_handle_alloc(self):
# verify that dlopen does not allocate already used handles
dirname = self.get_dir()

def indir(name):
return os.path.join(dirname, name)

create_file('a.cpp', r'''
#include <stdio.h>

Expand Down
5 changes: 0 additions & 5 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,12 @@
from tools.settings import settings
from tools.system_libs import DETERMINISTIC_PREFIX

scons_path = shutil.which('scons')
emmake = shared.bat_suffix(path_from_root('emmake'))
emconfig = shared.bat_suffix(path_from_root('em-config'))
emsize = shared.bat_suffix(path_from_root('emsize'))
emprofile = shared.bat_suffix(path_from_root('emprofile'))
emstrip = shared.bat_suffix(path_from_root('emstrip'))
emsymbolizer = shared.bat_suffix(path_from_root('emsymbolizer'))
wasm_opt = Path(building.get_binaryen_bin(), 'wasm-opt')


def is_bitcode(filename):
Expand Down Expand Up @@ -3055,9 +3053,6 @@ def verify_dwarf(self, wasm_file, verify_func):
def verify_dwarf_exists(self, wasm_file):
self.verify_dwarf(wasm_file, self.assertIn)

def verify_dwarf_does_not_exist(self, wasm_file):
self.verify_dwarf(wasm_file, self.assertNotIn)

# Verify if the given file name contains a source map
def verify_source_map_exists(self, map_file):
self.assertExists(map_file)
Expand Down
2 changes: 0 additions & 2 deletions tools/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def __init__(self):
self.post_link = False
self.save_temps = False
self.executable = False
self.compiler_wrapper = None
self.oformat = None
self.requested_debug = None
self.emit_symbol_map = False
Expand All @@ -78,7 +77,6 @@ def __init__(self):
self.shell_path = None
self.source_map_base = ''
self.emit_tsd = ''
self.embind_emit_tsd = ''
self.emrun = False
self.cpu_profiler = False
self.memory_profiler = False
Expand Down
11 changes: 0 additions & 11 deletions tools/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# diagnostic levels
WARN = 1
ERROR = 2
FATAL = 3

# available colors
RED = 1
Expand Down Expand Up @@ -249,16 +248,6 @@ def add_warning(name, enabled=True, part_of_all=True, shared=False, error=False)
manager.add_warning(name, enabled, part_of_all, shared, error)


def enable_warning(name, as_error=False):
manager.warnings[name]['enabled'] = True
if as_error:
manager.warnings[name]['error'] = True


def disable_warning(name):
manager.warnings[name]['enabled'] = False


def is_enabled(name):
return manager.warnings[name]['enabled']

Expand Down
1 change: 0 additions & 1 deletion tools/feature_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class Feature(IntEnum):
MEMORY64 = auto()


default_features = {Feature.SIGN_EXT, Feature.MUTABLE_GLOBALS}
disable_override_features = set()
enable_override_features = set()

Expand Down
1 change: 0 additions & 1 deletion tools/js_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

func_sig = re.compile(r'function ([_\w$]+)\(')
func_sig_json = re.compile(r'\["defun", ?"([_\w$]+)",')
import_sig = re.compile(r'(var|const) ([_\w$]+ *=[^;]+);')


def get_acorn_cmd():
Expand Down
11 changes: 4 additions & 7 deletions tools/maint/create_dom_pk_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,29 +237,26 @@ def hash_all(k1, k2):
else:
hashes[h] = s[1]
str_to_hash[s[1]] = h
return (hashes, str_to_hash)
return str_to_hash


# Find an appropriate hash function that is collision free within the set of all input strings
# Try hash function format h_i = ((h_(i-1) ^ k_1) << k_2) ^ s_i, where h_i is the hash function
# value at step i, k_1 and k_2 are the constants we are searching, and s_i is the i'th input
# character
perfect_hash_table = None

# Last used perfect hash constants. Stored here so that this script will
# produce the same output it did when the current output was generated.
k1 = 0x7E057D79
k2 = 3
perfect_hash_table = hash_all(k1, k2)
str_to_hash = hash_all(k1, k2)

while not perfect_hash_table:
while not str_to_hash:
# The search space is super-narrow, but since there are so few items to hash, practically
# almost any choice gives a collision free hash.
k1 = int(random.randint(0, 0x7FFFFFFF))
k2 = int(random.uniform(1, 8))
perfect_hash_table = hash_all(k1, k2)

hash_to_str, str_to_hash = perfect_hash_table
str_to_hash = hash_all(k1, k2)

print('Found collision-free hash function!', file=sys.stderr)
print('h_i = ((h_(i-1) ^ %s) << %s) ^ s_i' % (hex(k1), hex(k2)), file=sys.stderr)
Expand Down