diff --git a/test/test_other.py b/test/test_other.py index e71660697e280..199f12c9bdd01 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -15078,14 +15078,14 @@ def test_empath_split(self): void foo() { std::cout << "foo" << std::endl; } ''') create_file('path_list.txt', r''' - myapp + myapp: main.cpp foo.cpp - lib1 + lib1: /emsdk/emscripten/system - lib2 + lib2: /emsdk/emscripten/system/lib/libc/musl /emsdk/emscripten/system/lib/libcxx ''') diff --git a/tools/empath-split.py b/tools/empath-split.py index d92e1c98c536d..3b66d02f7c8a5 100755 --- a/tools/empath-split.py +++ b/tools/empath-split.py @@ -25,12 +25,13 @@ to split modules. The format is similar to the manifest file for wasm-split, but with paths instead of function names. A module is defined by a name on a line, followed by paths on subsequent lines. Modules are separated by empty lines. +Module names be written with a colon (:). For example: -module1 +module1: path/to/a path/to/b -module2 +module2: path/to/c This will create two modules, 'module1' and 'module2'. 'module1' will contain @@ -276,7 +277,11 @@ def parse_paths_file(paths_file_content): continue if not cur_module: - cur_module = line + if line[-1] != ':': + exit_with_error(f"Module name should end with a colon: {line}") + if len(line) == 1: + exit_with_error("Module name is empty") + cur_module = line[:-1] else: path = normalize_path(line) if path in path_to_module: @@ -337,7 +342,7 @@ def main(): print(' ' + func) print() - f.write(f'{module}\n') + f.write(f'{module}:\n') for func in funcs: f.write(func + '\n') f.close()