mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 06:12:27 +00:00
Introduce testlib_extract() helper
This commit is contained in:
parent
ecb2ef7c39
commit
27b5deefb1
7 changed files with 53 additions and 54 deletions
|
@ -18,7 +18,6 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/mem/copyfd.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
|
@ -26,6 +25,7 @@
|
|||
#include "libc/limits.h"
|
||||
#include "libc/log/libfatal.internal.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/mem/copyfd.internal.h"
|
||||
#include "libc/mem/gc.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/internal.h"
|
||||
|
@ -40,24 +40,15 @@
|
|||
#include "libc/x/xasprintf.h"
|
||||
#include "net/http/escape.h"
|
||||
|
||||
STATIC_YOINK("zip_uri_support");
|
||||
STATIC_YOINK("backtrace.com");
|
||||
STATIC_YOINK("backtrace.com.dbg");
|
||||
|
||||
char testlib_enable_tmp_setup_teardown_once;
|
||||
|
||||
void Extract(const char *from, const char *to, int mode) {
|
||||
ASSERT_SYS(0, 3, open(from, O_RDONLY));
|
||||
ASSERT_SYS(0, 4, creat(to, mode));
|
||||
ASSERT_NE(-1, _copyfd(3, 4, -1));
|
||||
EXPECT_SYS(0, 0, close(4));
|
||||
EXPECT_SYS(0, 0, close(3));
|
||||
}
|
||||
|
||||
void SetUpOnce(void) {
|
||||
ASSERT_NE(-1, mkdir("bin", 0755));
|
||||
Extract("/zip/backtrace.com", "bin/backtrace.com", 0755);
|
||||
Extract("/zip/backtrace.com.dbg", "bin/backtrace.com.dbg", 0755);
|
||||
testlib_extract("/zip/backtrace.com", "bin/backtrace.com", 0755);
|
||||
testlib_extract("/zip/backtrace.com.dbg", "bin/backtrace.com.dbg", 0755);
|
||||
}
|
||||
|
||||
static bool OutputHasSymbol(const char *output, const char *s) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue