test: cover exact package tool invocation paths

This commit is contained in:
2026-08-12 14:29:17 +09:00
parent d78020baf7
commit bb71b31f81
6 changed files with 321 additions and 31 deletions

View File

@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
/* `path` is acceptable iff it's either an archive ("!<arch>\n") or
* an ELF file ("\x7fELF"). Distros often ship lib<name>.so as a GNU
@@ -128,10 +129,9 @@ main(int argc, char **argv)
}
int rc = l_emit_elf(&l, f, base, base + 0x1000 + entry->val);
fclose(f);
if (rc == 0) {
char cmd[1024];
snprintf(cmd, sizeof cmd, "chmod +x %s", out);
(void)system(cmd);
if (rc == 0 && chmod(out, 0755) != 0) {
fprintf(stderr, "w6l: cannot make %s executable\n", out);
rc = 1;
}
free(inputs);
return rc;