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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ jobs:
# note we do *not* build all libraries and freeze the cache; as we run
# only limited tests here, it's more efficient to build on demand
- run-tests:
test_targets: "other.test_emcc_cflags other.test_stdin other.test_bad_triple core2.test_sse1 core2.test_ccall other.test_closure_externs other.test_binaryen_debug other.test_js_optimizer_parse_error other.test_output_to_nowhere other.test_emcc_dev_null other.test_cmake* other.test_system_include_paths other.test_emar_response_file core2.test_utf16 other.test_special_chars_in_arguments other.test_toolchain_profiler other.test_realpath_nodefs other.test_response_file_encoding other.test_libc_progname"
test_targets: "other.test_emcc_cflags other.test_stdin other.test_bad_triple core2.test_sse1 core2.test_ccall other.test_closure_externs other.test_binaryen_debug other.test_js_optimizer_parse_error other.test_output_to_nowhere other.test_emcc_dev_null other.test_cmake* other.test_system_include_paths other.test_emar_response_file core2.test_utf16 other.test_special_chars_in_arguments other.test_toolchain_profiler other.test_realpath_nodefs other.test_response_file_encoding other.test_libc_progname other.test_realpath other.test_embed_file_dup"
test-mac:
executor: mac
environment:
Expand Down
15 changes: 10 additions & 5 deletions tools/file_packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ def err(*args):
print(*args, file=sys.stderr)


def to_unix_path(p):
return p.replace(os.path.sep, '/')


def base64_encode(b):
b64 = base64.b64encode(b)
return b64.decode('ascii')
Expand Down Expand Up @@ -265,18 +269,19 @@ def generate_object_file(data_files):
err('embedding %s at %s' % (f.srcpath, f.dstpath))

size = os.path.getsize(f.srcpath)
name = to_asm_string(f.dstpath)
dstpath = to_asm_string(f.dstpath)
srcpath = to_unix_path(f.srcpath)
out.write(dedent(f'''
.section .rodata.{f.c_symbol_name},"",@

# The name of file
{f.c_symbol_name}_name:
.asciz "{name}"
.size {f.c_symbol_name}_name, {len(name)+1}
.asciz "{dstpath}"
.size {f.c_symbol_name}_name, {len(dstpath)+1}

# The size of the file followed by the content itself
{f.c_symbol_name}:
.incbin "{f.srcpath}"
.incbin "{srcpath}"
.size {f.c_symbol_name}, {size}
'''))

Expand Down Expand Up @@ -462,7 +467,7 @@ def main():

for file_ in data_files:
# name in the filesystem, native and emulated
file_.dstpath = file_.dstpath.replace(os.path.sep, '/')
file_.dstpath = to_unix_path(file_.dstpath)
# If user has submitted a directory name as the destination but omitted
# the destination filename, use the filename from source file
if file_.dstpath.endswith('/'):
Expand Down