1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-11 09:50:12 +00:00

MFp4 @1189766:

- Compile the tests with .t suffix, so prove can use them directly.
- The CHECKX() macro should increment ntest just like the CHECK() macro.
- For consistency remove # from the pwd.t output.

Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
This commit is contained in:
Pawel Jakub Dawidek 2014-01-04 09:25:27 +00:00
parent 146ff0f40f
commit b298769db3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=260253
5 changed files with 18 additions and 12 deletions

View File

@ -15,12 +15,14 @@ CFLAGS+= -Wold-style-definition -Wno-pointer-sign
CFLAGS+= -I${.CURDIR}/../../../../lib/libcapsicum
CFLAGS+= -ggdb
all: ${SERVICES}
SERVTEST= ${SERVICES:=.t}
all: ${SERVTEST}
.for SERVICE in ${SERVICES}
${SERVICE}: ${SERVICE}.c
${CC} ${CFLAGS} ${@}.c -o $@ -lcapsicum -lnv
${SERVICE}.t: ${SERVICE}.c
${CC} ${CFLAGS} ${@:.t=.c} -o $@ -lcapsicum -lnv
.endfor
@ -28,4 +30,4 @@ test: all
@prove -r ${.CURDIR}
clean:
rm -f ${SERVICES}
rm -f ${SERVTEST}

View File

@ -64,6 +64,7 @@ static int ntest = 1;
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
exit(1); \
} \
ntest++; \
} while (0)
#define GETHOSTBYNAME 0x01
@ -223,7 +224,7 @@ main(void)
const char *types[2];
int families[2];
printf("1..89\n");
printf("1..91\n");
capcas = cap_init();
CHECKX(capcas != NULL);

View File

@ -61,6 +61,7 @@ static int ntest = 1;
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
exit(1); \
} \
ntest++; \
} while (0)
#define GID_WHEEL 0
@ -1522,7 +1523,7 @@ main(void)
{
cap_channel_t *capcas, *capgrp;
printf("1..197\n");
printf("1..199\n");
capcas = cap_init();
CHECKX(capcas != NULL);

View File

@ -49,18 +49,19 @@ static int ntest = 1;
#define CHECK(expr) do { \
if ((expr)) \
printf("ok # %d %s:%u\n", ntest, __FILE__, __LINE__); \
printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
else \
printf("not ok # %d %s:%u\n", ntest, __FILE__, __LINE__);\
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__);\
ntest++; \
} while (0)
#define CHECKX(expr) do { \
if ((expr)) { \
printf("ok # %d %s:%u\n", ntest, __FILE__, __LINE__); \
printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
} else { \
printf("not ok # %d %s:%u\n", ntest, __FILE__, __LINE__);\
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__);\
exit(1); \
} \
ntest++; \
} while (0)
#define UID_ROOT 0
@ -1508,7 +1509,7 @@ main(void)
{
cap_channel_t *capcas, *cappwd;
printf("1..186\n");
printf("1..188\n");
capcas = cap_init();
CHECKX(capcas != NULL);

View File

@ -73,6 +73,7 @@ static int ntest = 1;
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
exit(1); \
} \
ntest++; \
} while (0)
#define SYSCTL0_READ0 0x0001
@ -1470,7 +1471,7 @@ main(void)
int scvalue0, scvalue1;
size_t scsize;
printf("1..250\n");
printf("1..256\n");
scsize = sizeof(scvalue0);
CHECKX(sysctlbyname(SYSCTL0_NAME, &scvalue0, &scsize, NULL, 0) == 0);