[master] b096e4e Add three new feature checks:
Poul-Henning Kamp
phk at FreeBSD.org
Wed Mar 4 16:23:35 CET 2015
commit b096e4edad3584f8dd53eb445dec18654c8e262b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Mar 4 15:21:30 2015 +0000
Add three new feature checks:
root -- you must be root
user_varnish -- system must have a "varnish" user
group_varnish -- system must have a "varnish" group
diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index 5759d38..6abc7bb 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -39,6 +39,8 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <pwd.h>
+#include <grp.h>
#include "vtc.h"
@@ -515,6 +517,17 @@ cmd_feature(CMD_ARGS)
if (!strcmp(av[i], "topbuild") && iflg)
continue;
+ if (!strcmp(av[i], "root") && !geteuid())
+ continue;
+
+ if (!strcmp(av[i], "user_varnish") &&
+ getpwnam("varnish") != NULL)
+ continue;
+
+ if (!strcmp(av[i], "group_varnish") &&
+ getgrnam("varnish") != NULL)
+ continue;
+
vtc_log(vl, 1, "SKIPPING test, missing feature: %s", av[i]);
vtc_stop = 1;
return;
More information about the varnish-commit
mailing list