Skip to content

Commit d8fd043

Browse files
committed
Fix posix_extensive test failure
1 parent 44f8126 commit d8fd043

11 files changed

Lines changed: 85 additions & 107 deletions

test/libc_parity_basic.c

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,28 @@
11
#include <errno.h>
2-
#include <stdio.h>
3-
#include <stdlib.h>
42
#include <string.h>
5-
6-
static void parity_mark(const char *name)
7-
{
8-
if (getenv("ZIGLIBC_TEST_MARKERS") != NULL) {
9-
fputs(name, stderr);
10-
fputc('\n', stderr);
11-
fflush(stderr);
12-
}
13-
}
3+
#include "test_markers.h"
144

155
int main(void)
166
{
17-
parity_mark("parity:block:system-null");
7+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "parity:block:system-null");
188
printf("system-null:%d|", system(NULL) != 0);
199

20-
parity_mark("parity:block:system-exit7");
10+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "parity:block:system-exit7");
2111
printf("system-exit7:%d|", system("exit 7"));
2212

23-
parity_mark("parity:block:getenv-path");
13+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "parity:block:getenv-path");
2414
{ const char *path = getenv("PATH"); printf("getenv-path:%s|", path ? path : "(null)"); }
2515

26-
parity_mark("parity:block:popen-read");
16+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "parity:block:popen-read");
2717
{ FILE *p = popen("printf popen-ok", "r"); char buf[64] = {0}; if (!p || !fgets(buf, sizeof(buf), p)) return 1; printf("popen-read:%s:%d|", buf, pclose(p)); }
2818

29-
parity_mark("parity:block:popen-path");
19+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "parity:block:popen-path");
3020
{ const char *home = getenv("HOME"); if (home && home[0]) { FILE *p = popen("printf yes", "r"); char buf[16] = {0}; if (!p || !fgets(buf, sizeof(buf), p)) return 1; printf("popen-path:%s:%d|", buf, pclose(p)); } else { printf("popen-path:skip|"); } }
3121

32-
parity_mark("parity:block:popen-exit");
22+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "parity:block:popen-exit");
3323
printf("popen-exit5:%d|", pclose(popen("exit 5", "r")));
3424

35-
parity_mark("parity:block:fopen-many");
25+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "parity:block:fopen-many");
3626
{
3727
FILE *files[128]; size_t count = 0;
3828
while (count < (sizeof(files)/sizeof(files[0]))) {

test/libc_parity_posix_fs.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,29 @@
11
#include <errno.h>
22
#include <fcntl.h>
3-
#include <stdio.h>
43
#include <string.h>
54
#ifndef _WIN32
65
#include <sys/stat.h>
76
#include <sys/time.h>
87
#include <sys/uio.h>
98
#endif
109
#include <unistd.h>
11-
12-
static void parity_mark(const char *name)
13-
{
14-
fputs(name, stderr);
15-
fputc('\n', stderr);
16-
fflush(stderr);
17-
}
10+
#include "test_markers.h"
1811

1912
int main(void)
2013
{
21-
setvbuf(stdout, NULL, _IONBF, 0);
22-
setvbuf(stderr, NULL, _IONBF, 0);
14+
TEST_SET_UNBUFFERED();
2315

2416
#if LIBC_PARITY_HAVE_POSIX_IO
2517
{
2618
char host[256];
27-
parity_mark("parity_posix_fs:block:gethostname");
19+
TEST_MARK_ALWAYS("parity_posix_fs:block:gethostname");
2820
if (gethostname(host, sizeof(host)) != 0) return 1;
2921
printf("gethostname:%s|", host);
3022
}
3123
{
3224
int fd;
3325
struct stat st;
34-
parity_mark("parity_posix_fs:block:openat");
26+
TEST_MARK_ALWAYS("parity_posix_fs:block:openat");
3527
fd = openat(AT_FDCWD, "parity-openat.tmp", O_CREAT | O_TRUNC | O_RDWR, 0600);
3628
if (fd < 0) return 1;
3729
if (write(fd, "hi", 2) != 2) return 1;
@@ -43,7 +35,7 @@ int main(void)
4335
{
4436
int fd, rc;
4537
struct stat a, b;
46-
parity_mark("parity_posix_fs:block:link");
38+
TEST_MARK_ALWAYS("parity_posix_fs:block:link");
4739
fd = open("parity-link-src.tmp", O_CREAT | O_TRUNC | O_RDWR, 0600);
4840
if (fd < 0) return 1;
4941
if (write(fd, "xy", 2) != 2) return 1;
@@ -59,7 +51,7 @@ int main(void)
5951
}
6052
{
6153
int fd, flags, dupfd, getfd_flags;
62-
parity_mark("parity_posix_fs:block:fcntl");
54+
TEST_MARK_ALWAYS("parity_posix_fs:block:fcntl");
6355
fd = open("parity-fcntl.tmp", O_CREAT | O_TRUNC | O_RDWR, 0600);
6456
if (fd < 0) return 1;
6557
flags = fcntl(fd, F_GETFL);
@@ -75,7 +67,7 @@ int main(void)
7567
int fd, read_ok, write_rc;
7668
struct iovec outv[2], inv[2];
7769
char a[3] = {0}, b[3] = {0};
78-
parity_mark("parity_posix_fs:block:writev");
70+
TEST_MARK_ALWAYS("parity_posix_fs:block:writev");
7971
fd = open("parity-writev.tmp", O_CREAT | O_TRUNC | O_RDWR, 0600);
8072
if (fd < 0) return 1;
8173
outv[0].iov_base = (void *)"ab"; outv[0].iov_len = 2;
@@ -92,7 +84,7 @@ int main(void)
9284
unlink("parity-writev.tmp");
9385
}
9486
{
95-
parity_mark("parity_posix_fs:block:pathconf");
87+
TEST_MARK_ALWAYS("parity_posix_fs:block:pathconf");
9688
printf("pathconf-basic:%d:%d|", pathconf(".", _PC_LINK_MAX) > 0, fpathconf(STDIN_FILENO, _PC_LINK_MAX) > 0 || errno != 0);
9789
}
9890
#else

test/libc_parity_posix_timer.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
#include <errno.h>
2-
#include <stdio.h>
32
#include <string.h>
43
#ifndef _WIN32
54
#include <sys/select.h>
65
#include <sys/time.h>
76
#include <time.h>
87
#endif
9-
10-
static void parity_mark(const char *name)
11-
{
12-
fputs(name, stderr);
13-
fputc('\n', stderr);
14-
fflush(stderr);
15-
}
8+
#include "test_markers.h"
169

1710
int main(void)
1811
{
19-
setvbuf(stdout, NULL, _IONBF, 0);
20-
setvbuf(stderr, NULL, _IONBF, 0);
21-
parity_mark("parity_posix_timer:block:setitimer");
12+
TEST_SET_UNBUFFERED();
13+
TEST_MARK_ALWAYS("parity_posix_timer:block:setitimer");
2214
#if LIBC_PARITY_HAVE_SETITIMER
2315
{
2416
struct itimerval val, old;
@@ -33,7 +25,7 @@ int main(void)
3325
printf("setitimer-zero:skip|");
3426
#endif
3527

36-
parity_mark("parity_posix_timer:block:select");
28+
TEST_MARK_ALWAYS("parity_posix_timer:block:select");
3729
#if LIBC_PARITY_HAVE_SELECT
3830
{
3931
struct timeval tv = {0,0};
@@ -46,7 +38,7 @@ int main(void)
4638
printf("select-timeout:skip");
4739
#endif
4840

49-
parity_mark("parity_posix_timer:block:pselect");
41+
TEST_MARK_ALWAYS("parity_posix_timer:block:pselect");
5042
#if LIBC_PARITY_HAVE_PSELECT
5143
{
5244
struct timespec ts = {0,0};

test/libc_parity_posix_utimes.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
#include <errno.h>
2-
#include <stdio.h>
32
#ifndef _WIN32
43
#include <sys/stat.h>
54
#include <sys/time.h>
65
#endif
76
#include <unistd.h>
8-
9-
static void parity_mark(const char *name)
10-
{
11-
fputs(name, stderr);
12-
fputc('\n', stderr);
13-
fflush(stderr);
14-
}
7+
#include "test_markers.h"
158

169
int main(void)
1710
{
18-
setvbuf(stdout, NULL, _IONBF, 0);
19-
setvbuf(stderr, NULL, _IONBF, 0);
11+
TEST_SET_UNBUFFERED();
2012

21-
parity_mark("parity_posix_utimes:block:utimes");
13+
TEST_MARK_ALWAYS("parity_posix_utimes:block:utimes");
2214
#if LIBC_PARITY_HAVE_UTIMES
2315
{
2416
struct timeval tv[2];

test/libc_parity_signal.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,28 @@
11
#include <errno.h>
22
#include <signal.h>
3-
#include <stdio.h>
4-
#include <stdlib.h>
53
#include <string.h>
6-
7-
static void parity_mark(const char *name)
8-
{
9-
if (getenv("ZIGLIBC_TEST_MARKERS") != NULL) {
10-
fputs(name, stderr);
11-
fputc('\n', stderr);
12-
fflush(stderr);
13-
}
14-
}
4+
#include "test_markers.h"
155

166
static void parity_handler(int sig) { (void)sig; }
177

188
int main(void)
199
{
2010
{
21-
parity_mark("parity:block:signal");
11+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "parity:block:signal");
2212
void (*old_handler)(int) = signal(SIGINT, parity_handler);
2313
void (*prev_handler)(int) = signal(SIGINT, old_handler);
2414
printf("signal-basic:%d:%d:%d:%d|", old_handler != SIG_ERR, prev_handler == parity_handler, old_handler == SIG_DFL, prev_handler == SIG_DFL);
2515
}
2616

2717
{
28-
parity_mark("parity:block:strtol");
18+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "parity:block:strtol");
2919
const char *s = "abc"; char *endptr = NULL; long value; long dist;
3020
errno = 123; value = strtol(s, &endptr, 10); dist = (long)(endptr - s);
3121
printf("strtol-nodigits:%ld:%d:%ld|", value, errno, dist);
3222
}
3323

3424
{
35-
parity_mark("parity:block:strtod");
25+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "parity:block:strtod");
3626
const char *s = "abc"; char *endptr = NULL; double value; long dist;
3727
errno = 123; value = strtod(s, &endptr); dist = (long)(endptr - s);
3828
printf("strtod-nodigits:%d:%d:%ld|", value == 0.0, errno, dist);

test/panic_math_locale.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
#include <locale.h>
22
#include <math.h>
3-
#include <stdio.h>
4-
#include <stdlib.h>
53
#include <string.h>
64
#include "expect.h"
7-
8-
#define PANIC_MARK(name) do { if (getenv("ZIGLIBC_TEST_MARKERS") != NULL) { fputs(name, stderr); fputc('\n', stderr); fflush(stderr); } } while (0)
5+
#include "test_markers.h"
96

107
int main(void)
118
{
129
{
13-
PANIC_MARK("panic_math_locale:block:math");
10+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "panic_math_locale:block:math");
1411
double v;
1512
v = acos(1.0); expect(v > -1e-12 && v < 1e-12);
1613
v = asin(0.0); expect(v > -1e-12 && v < 1e-12);
@@ -20,7 +17,7 @@ int main(void)
2017
}
2118

2219
{
23-
PANIC_MARK("panic_math_locale:block:locale");
20+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "panic_math_locale:block:locale");
2421
expect(NULL != setlocale(LC_ALL, "C"));
2522
expect(0 == strcmp("C", setlocale(LC_ALL, NULL)));
2623
expect(0 == strcmp("C", setlocale(LC_ALL, "")));

test/panic_stdio.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
#include <errno.h>
22
#include <stdio.h>
3-
#include <stdlib.h>
43
#include <time.h>
54
#include "expect.h"
6-
7-
#define PANIC_MARK(name) do { if (getenv("ZIGLIBC_TEST_MARKERS") != NULL) { fputs(name, stderr); fputc('\n', stderr); fflush(stderr); } } while (0)
5+
#include "test_markers.h"
86

97
int main(void)
108
{
119
{
12-
PANIC_MARK("panic_stdio:block:stdio-file");
10+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "panic_stdio:block:stdio-file");
1311
const char *name = "panic-repl.tmp";
1412
const char *renamed = "panic-repl-renamed.tmp";
1513
FILE *f = fopen(name, "w");
@@ -29,7 +27,7 @@ int main(void)
2927
}
3028
#ifndef _WIN32
3129
{
32-
PANIC_MARK("panic_stdio:block:fopen-many");
30+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "panic_stdio:block:fopen-many");
3331
FILE *files[256];
3432
size_t count = 0;
3533
while (count < (sizeof(files) / sizeof(files[0]))) {
@@ -44,7 +42,7 @@ int main(void)
4442
}
4543
}
4644
#endif
47-
PANIC_MARK("panic_stdio:block:perror");
45+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "panic_stdio:block:perror");
4846
errno = ENOENT;
4947
perror("panic_stdio");
5048
puts("Success!");

test/panic_time_core.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
#include <stdio.h>
2-
#include <stdlib.h>
32
#include <time.h>
43
#include "expect.h"
5-
6-
#define PANIC_MARK(name) do { if (getenv("ZIGLIBC_TEST_MARKERS") != NULL) { fputs(name, stderr); fputc('\n', stderr); fflush(stderr); } } while (0)
4+
#include "test_markers.h"
75

86
int main(void)
97
{
108
{
11-
PANIC_MARK("panic_time_core:block:clock");
9+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "panic_time_core:block:clock");
1210
clock_t c1 = clock();
1311
clock_t c2 = clock();
1412
expect(c1 >= 0);
1513
expect(c2 >= c1);
1614
}
1715

18-
PANIC_MARK("panic_time_core:block:difftime");
16+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "panic_time_core:block:difftime");
1917
expect(7.0 == difftime((time_t)10, (time_t)3));
2018

2119
{
22-
PANIC_MARK("panic_time_core:block:time-convert");
20+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "panic_time_core:block:time-convert");
2321
time_t t0 = 0;
2422
struct tm *utc = gmtime(&t0);
2523
struct tm *local = localtime(&t0);
@@ -32,7 +30,7 @@ int main(void)
3230
}
3331

3432
{
35-
PANIC_MARK("panic_time_core:block:mktime");
33+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "panic_time_core:block:mktime");
3634
struct tm tm = {0};
3735
tm.tm_year = 70;
3836
tm.tm_mon = 0;

test/posix_file_extensive.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,35 @@
1212
#include <time.h>
1313
#include <unistd.h>
1414
#include "expect.h"
15-
#define POSIX_MARK(name) do { if (getenv("ZIGLIBC_TEST_MARKERS") != NULL) { fputs(name, stderr); fputc('\n', stderr); fflush(stderr); } } while (0)
15+
#include "test_markers.h"
1616
int main(void) {
1717
const char *name; int fd; struct stat st;
18-
POSIX_MARK("posix_file:block:access");
18+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "posix_file:block:access");
1919
{ FILE *f=fopen("posix-ext.tmp","w"); expect(f!=NULL); expect(fileno(f)>=0); expect(0==fclose(f)); expect(0==access("posix-ext.tmp",R_OK)); expect(-1==access("missing-posix-ext.tmp",R_OK)); expect(0==unlink("posix-ext.tmp")); expect(-1==unlink("posix-ext.tmp")); }
20-
POSIX_MARK("posix_file:block:readwrite-errors");
20+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "posix_file:block:readwrite-errors");
2121
{ char ch; errno=0; expect(-1==read(-1,&ch,1)); expect(0!=errno); errno=0; expect(-1==write(-1,"x",1)); expect(0!=errno); }
22-
POSIX_MARK("posix_file:block:dirent-single");
22+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "posix_file:block:dirent-single");
2323
{ FILE *df=fopen("posix-dirent.tmp","w"); DIR *dir; struct dirent *ent; int saw=0; expect(df!=NULL); expect(0==fclose(df)); dir=opendir("."); expect(dir!=NULL); while((ent=readdir(dir))!=NULL){ if(strcmp(ent->d_name,"posix-dirent.tmp")==0){ saw=1; break; }} expect(saw); expect(0==closedir(dir)); expect(0==unlink("posix-dirent.tmp")); }
24-
POSIX_MARK("posix_file:block:gethostname");
24+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "posix_file:block:gethostname");
2525
{ char host[256]; expect(0==gethostname(host,sizeof(host))); expect(host[0] != '\0'); errno=0; expect(-1==gethostname(host,0)); expect(EINVAL==errno); }
26-
POSIX_MARK("posix_file:block:dirname");
26+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "posix_file:block:dirname");
2727
{ char path1[]="/usr/lib"; char path2[]="noslash"; char path3[]="/"; expect(strcmp("/usr",dirname(path1))==0); expect(strcmp(".",dirname(path2))==0); expect(strcmp("/",dirname(path3))==0); }
28-
POSIX_MARK("posix_file:block:time");
28+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "posix_file:block:time");
2929
{ time_t t=946684800; struct tm *utc=gmtime(&t); char *asc; char *ct; expect(utc!=NULL); asc=asctime(utc); expect(asc!=NULL); expect(0==strncmp(asc,"Sat Jan 1 00:00:00 2000\n",25)); ct=ctime(&t); expect(ct!=NULL); expect(0==strcmp(ct, asctime(localtime(&t)))); expect(0==sleep(0)); }
30-
POSIX_MARK("posix_file:block:stat");
30+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "posix_file:block:stat");
3131
fd=open("posix-stat.tmp",O_CREAT|O_TRUNC|O_RDWR,0600); expect(fd>=0); expect(3==write(fd,"abc",3)); expect(0==fstat(fd,&st)); expect(3==st.st_size); expect(0==chmod("posix-stat.tmp",0600)); expect(0==close(fd)); expect(0==unlink("posix-stat.tmp"));
32-
POSIX_MARK("posix_file:block:openat");
32+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "posix_file:block:openat");
3333
{ mode_t old=umask(022); mode_t prev=umask(old); expect(022==prev); }
3434
fd=openat(AT_FDCWD,"posix-openat.tmp",O_CREAT|O_TRUNC|O_RDWR,0600); expect(fd>=0); expect(4==write(fd,"open",4)); expect(0==close(fd)); expect(0==stat("posix-openat.tmp",&st)); expect(4==st.st_size); expect(0==unlink("posix-openat.tmp"));
3535
{ int dirfd=open(".",O_RDONLY); expect(dirfd>=0); fd=openat(dirfd,"posix-openat-relative.tmp",O_CREAT|O_TRUNC|O_RDWR,0600); expect(fd>=0); expect(3==write(fd,"dir",3)); expect(0==close(fd)); expect(0==stat("posix-openat-relative.tmp",&st)); expect(3==st.st_size); expect(0==close(dirfd)); expect(0==unlink("posix-openat-relative.tmp")); }
36-
POSIX_MARK("posix_file:block:fcntl");
36+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "posix_file:block:fcntl");
3737
{ int flags, dupfd; fd=open("posix-fcntl.tmp",O_CREAT|O_TRUNC|O_RDWR,0600); expect(fd>=0); flags=fcntl(fd,F_GETFL); expect(flags>=0); expect((flags&0x3)==O_RDWR); expect(0==fcntl(fd,F_SETFD,FD_CLOEXEC)); flags=fcntl(fd,F_GETFD); expect(flags>=0); expect((flags&FD_CLOEXEC)==FD_CLOEXEC); dupfd=fcntl(fd,F_DUPFD,8); expect(dupfd>=8); expect(dupfd != fd); expect(0==close(dupfd)); expect(0==close(fd)); expect(0==unlink("posix-fcntl.tmp")); }
3838
{ mode_t old=umask(077); fd=open("posix-umask.tmp",O_CREAT|O_TRUNC|O_RDWR,0666); expect(fd>=0); expect(0==close(fd)); expect(0==stat("posix-umask.tmp",&st)); expect((st.st_mode & 0777)==0600); expect(0==unlink("posix-umask.tmp")); (void)umask(old); }
39-
POSIX_MARK("posix_file:block:link");
39+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "posix_file:block:link");
4040
{ struct stat st_src, st_alias; fd=open("posix-link-src.tmp",O_CREAT|O_TRUNC|O_RDWR,0600); expect(fd>=0); expect(4==write(fd,"link",4)); expect(0==close(fd)); expect(0==link("posix-link-src.tmp","posix-link-dst.tmp")); expect(0==stat("posix-link-src.tmp",&st_src)); expect(0==stat("posix-link-dst.tmp",&st_alias)); expect(st_src.st_size==st_alias.st_size); expect(0==unlink("posix-link-dst.tmp")); expect(0==unlink("posix-link-src.tmp")); }
41-
POSIX_MARK("posix_file:block:writev");
41+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "posix_file:block:writev");
4242
{ struct iovec outv[2], inv[2]; char a[4]={0}, b[4]={0}; fd=open("posix-writev.tmp",O_CREAT|O_TRUNC|O_RDWR,0600); expect(fd>=0); outv[0].iov_base=(void*)"ab"; outv[0].iov_len=2; outv[1].iov_base=(void*)"cd"; outv[1].iov_len=2; expect(4==writev(fd,outv,2)); expect(0==close(fd)); fd=open("posix-writev.tmp",O_RDONLY); expect(fd>=0); inv[0].iov_base=a; inv[0].iov_len=2; inv[1].iov_base=b; inv[1].iov_len=2; expect(4==readv(fd,inv,2)); expect(0==memcmp(a,"ab",2)); expect(0==memcmp(b,"cd",2)); expect(0==close(fd)); expect(0==unlink("posix-writev.tmp")); }
43-
POSIX_MARK("posix_file:block:pathconf");
43+
TEST_MARK_IF_ENV("ZIGLIBC_TEST_MARKERS", "posix_file:block:pathconf");
4444
{ FILE *pf=fopen("posix-pathconf.tmp","w"); int pfd; expect(pathconf(".",_PC_LINK_MAX)>0); errno=0; expect(-1==pathconf(".",-1)); expect(EINVAL==errno); expect(pf!=NULL); pfd=fileno(pf); expect(fpathconf(pfd,_PC_LINK_MAX)>0); errno=0; expect(-1==fpathconf(-1,_PC_LINK_MAX)); expect(errno != 0); errno=0; expect(-1==fpathconf(12345,_PC_LINK_MAX)); expect(EBADF==errno); expect(0==fclose(pf)); expect(0==unlink("posix-pathconf.tmp")); }
4545
{ struct timeval tv; errno=0; expect(0==gettimeofday(&tv,NULL)); expect(0==errno); expect(tv.tv_usec>=0); expect(tv.tv_usec<1000000); }
4646
{ struct timespec ts; errno=0; expect(0==clock_gettime(CLOCK_REALTIME,&ts)); expect(0==errno); expect(ts.tv_nsec>=0); expect(ts.tv_nsec<1000000000L); }

0 commit comments

Comments
 (0)