mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-01 08:48:29 +00:00
Add smoke test for timezone loading (#114)
This commit is contained in:
parent
33e8fc8687
commit
0a61fe4ea0
12 changed files with 45 additions and 33 deletions
|
@ -12,7 +12,7 @@
|
|||
#include "libc/errno.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
|
@ -73,7 +73,7 @@ void GetOpts(int argc, char *argv[]) {
|
|||
|
||||
int cp(const char *src, const char *dst) {
|
||||
if (endswith(dst, "/") || isdirectory(dst)) {
|
||||
dst = gc(xasprintf("%s/%s", dst, basename));
|
||||
dst = _gc(xasprintf("%s/%s", dst, basename));
|
||||
}
|
||||
if (!force && access(dst, W_OK) == -1 && errno != ENOENT) goto OnFail;
|
||||
if (copyfile(src, dst, flags) == -1) goto OnFail;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "libc/log/log.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/nt/thread.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "libc/log/check.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/sock/sock.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
|
@ -60,17 +60,17 @@ int main(int argc, char *argv[]) {
|
|||
urislice2cstr(port, sizeof(port), u.port, url, "80");
|
||||
path = uripath(&u);
|
||||
pathstr = path.n ? url + path.i : "/";
|
||||
msg = gc(xstrcat("GET ", pathstr,
|
||||
" HTTP/1.1\r\n"
|
||||
"Host: ",
|
||||
host,
|
||||
"\r\n"
|
||||
"Connection: close\r\n"
|
||||
"Content-Length: 0\r\n"
|
||||
"Accept: text/plain; */*\r\n"
|
||||
"Accept-Encoding: identity\r\n"
|
||||
"User-Agent: github.com/jart/cosmopolitan\r\n"
|
||||
"\r\n"));
|
||||
msg = _gc(xstrcat("GET ", pathstr,
|
||||
" HTTP/1.1\r\n"
|
||||
"Host: ",
|
||||
host,
|
||||
"\r\n"
|
||||
"Connection: close\r\n"
|
||||
"Content-Length: 0\r\n"
|
||||
"Accept: text/plain; */*\r\n"
|
||||
"Accept-Encoding: identity\r\n"
|
||||
"User-Agent: github.com/jart/cosmopolitan\r\n"
|
||||
"\r\n"));
|
||||
msglen = strlen(msg);
|
||||
CHECK_EQ(EAI_SUCCESS, getaddrinfo(host, port, &hints, &addrs));
|
||||
for (addr = addrs; addr; addr = addr->ai_next) {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||
╚─────────────────────────────────────────────────────────────────*/
|
||||
#endif
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/x/x.h"
|
||||
|
||||
|
@ -16,6 +16,6 @@
|
|||
*/
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
puts(gc(xiso8601ts(NULL)));
|
||||
puts(_gc(xiso8601ts(NULL)));
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "libc/log/check.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "third_party/duktape/duktape.h"
|
||||
|
||||
|
@ -59,7 +59,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
CHECK_NE(-1, (fd = open("zip:examples/hello.js", O_RDONLY)));
|
||||
CHECK_NE(-1, fstat(fd, &st));
|
||||
CHECK_NOTNULL((code = gc(calloc(1, st.st_size + 1))));
|
||||
CHECK_NOTNULL((code = _gc(calloc(1, st.st_size + 1))));
|
||||
CHECK_EQ(st.st_size, read(fd, code, st.st_size));
|
||||
CHECK_NE(-1, close(fd));
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "libc/calls/struct/dirent.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/dt.h"
|
||||
|
@ -49,7 +49,7 @@ void List(const char *path) {
|
|||
if (strcmp(path, ".") == 0) {
|
||||
vpath = "";
|
||||
} else if (!endswith(path, "/")) {
|
||||
vpath = gc(xasprintf("%s/", path));
|
||||
vpath = _gc(xasprintf("%s/", path));
|
||||
} else {
|
||||
vpath = path;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "libc/calls/struct/timespec.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/sysv/consts/dt.h"
|
||||
#include "libc/x/x.h"
|
||||
|
@ -51,7 +51,7 @@ void WalkPaths(const char *dirpath) {
|
|||
if (strcmp(e->d_name, "o") == 0) continue;
|
||||
if (strcmp(e->d_name, ".git") == 0) continue;
|
||||
if (e->d_type == DT_DIR) {
|
||||
WalkPaths(gc(path));
|
||||
WalkPaths(_gc(path));
|
||||
} else {
|
||||
CHECK_NE(-1, lstat(path, &st), "%s", path);
|
||||
f.mt = st.st_mtim;
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "libc/math.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/ohmyplus/vector.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/sock/sock.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "libc/errno.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/x/x.h"
|
||||
|
||||
|
@ -44,9 +44,9 @@ void PrintFileMetadata(const char *pathname, struct stat *st) {
|
|||
"hard link count", st->st_nlink, "mode / permissions", st->st_mode,
|
||||
"owner id", st->st_uid, "group id", st->st_gid,
|
||||
"device id (if special)", st->st_rdev, "block size", st->st_blksize,
|
||||
"access time", gc(xiso8601(&st->st_atim)), "modified time",
|
||||
gc(xiso8601(&st->st_mtim)), "c[omplicated]time",
|
||||
gc(xiso8601(&st->st_ctim)));
|
||||
"access time", _gc(xiso8601(&st->st_atim)), "modified time",
|
||||
_gc(xiso8601(&st->st_mtim)), "c[omplicated]time",
|
||||
_gc(xiso8601(&st->st_ctim)));
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue