commit - 30d22cc724c2dab1c94046e33c729ed24f591b94
commit + 32b8add4cfa7e7c66ac6be38b2cc956880dde08c
blob - e1ef5a0a9c9724f8f4ce816d6a4aee0e4605678d
blob + 2df71001f2c0ddff2c4217feba1820fecb17df36
--- ninepscript.8
+++ ninepscript.8
.Sh SYNOPSIS
.Nm
.Op Fl nv
+.Op Fl x Ar pattern
.Ar
.Sh DESCRIPTION
.Nm
.Ar files .
.It Fl v
verbose logging, print more information during the tests execution.
+.It Fl x Ar pattern
+Run only the tests that match the given
+.Ar pattern .
.El
.Pp
.Nm
blob - 98be0d4eafb875d187341dd0b173b3f0fc039e03
blob + 4fb5bc0910430077c25c774212922762678ad98f
--- script.c
+++ script.c
#include <inttypes.h>
#include <poll.h>
#include <pwd.h>
+#include <regex.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
struct test *t;
int ch, i, r, passed = 0, failed = 0, skipped = 0;
int runclient = 0;
+ const char *pat = NULL;
+ regex_t reg;
assert(argv0 = argv[0]);
add_builtin_proc("send", builtin_send, 2, 1);
add_builtin_proc("recv", builtin_recv, 0, 0);
- while ((ch = getopt(argc, argv, "nT:v")) != -1) {
+ while ((ch = getopt(argc, argv, "nT:vx:")) != -1) {
switch (ch) {
case 'n':
syntaxcheck = 1;
case 'v':
debug = 1;
break;
+ case 'x':
+ pat = optarg;
+ break;
default:
fprintf(stderr, "Usage: %s [-nv] [files...]\n",
*argv);
if (runclient)
client(1, debug);
+
+ if (pat == NULL)
+ pat = ".*";
+ if (regcomp(®, pat, REG_BASIC | REG_ICASE | REG_NOSUB) != 0)
+ fatalx("invalid regexp: %s", pat);
+
for (i = 0; i < argc; ++i)
loadfile(argv[i]);
i = 0;
TAILQ_FOREACH(t, &tests, entry) {
+ if (regexec(®, t->name, 0, NULL, 0) != 0)
+ continue;
+
printf("===> [%d/%d] running test \"%s\"... ", i+1, ntests,
t->name);
fflush(stdout);
popenv();
free(lastmsg);
+ regfree(®);
return failed != 0;
}