[6.0] 3679ddc16 Make "vtest" an alias for "varnishtest" in the first line.
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:20 UTC 2018
commit 3679ddc162d6d8cd5aaffa1067d8fe834a522629
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Sep 24 07:16:10 2018 +0000
Make "vtest" an alias for "varnishtest" in the first line.
diff --git a/bin/varnishtest/cmds.h b/bin/varnishtest/cmds.h
index e856e6084..d3244c258 100644
--- a/bin/varnishtest/cmds.h
+++ b/bin/varnishtest/cmds.h
@@ -43,6 +43,7 @@ CMD(shell)
CMD(syslog)
CMD(varnish)
CMD(varnishtest)
+CMD(vtest)
#undef CMD
/*lint -restore */
diff --git a/bin/varnishtest/tests/a00000.vtc b/bin/varnishtest/tests/a00000.vtc
index 22e9f341b..8fb9ded32 100644
--- a/bin/varnishtest/tests/a00000.vtc
+++ b/bin/varnishtest/tests/a00000.vtc
@@ -10,7 +10,7 @@ shell {
echo 'shell "exit 9"' >> _.vtc
}
-shell -exit 2 -expect {doesn't start with 'varnishtest'} {
+shell -exit 2 -expect {doesn't start with 'vtest' or 'varnishtest'} {
varnishtest -v _.vtc
}
diff --git a/bin/varnishtest/tests/a00001.vtc b/bin/varnishtest/tests/a00001.vtc
index b6628d807..ea5b458f3 100644
--- a/bin/varnishtest/tests/a00001.vtc
+++ b/bin/varnishtest/tests/a00001.vtc
@@ -1,4 +1,4 @@
-varnishtest "Test Teken terminal emulator"
+vtest "Test Teken terminal emulator"
feature cmd "vttest --version 2>&1 | grep -q Usage"
diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index d6168a2ae..cb0c2f07f 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -547,9 +547,11 @@ read_file(const char *fn, int ntest)
return (2);
}
- if (strncmp(q, "varnishtest", 11) || !isspace(q[11])) {
+ if ((strncmp(q, "varnishtest", 11) || !isspace(q[11])) &&
+ (strncmp(q, "vtest", 5) || !isspace(q[5]))) {
fprintf(stderr,
- "File \"%s\" doesn't start with 'varnishtest'\n", fn);
+ "File \"%s\" doesn't start with"
+ " 'vtest' or 'varnishtest'\n", fn);
free(p);
vtc_skip++;
return(2);
diff --git a/bin/varnishtest/vtc_misc.c b/bin/varnishtest/vtc_misc.c
index 196b35c65..0c47fe88a 100644
--- a/bin/varnishtest/vtc_misc.c
+++ b/bin/varnishtest/vtc_misc.c
@@ -49,17 +49,39 @@
#include "vre.h"
#include "vtim.h"
-/* SECTION: varnishtest varnishtest
+/* SECTION: vtest vtest
*
* This should be the first command in your vtc as it will identify the test
* case with a short yet descriptive sentence. It takes exactly one argument, a
* string, eg::
*
- * varnishtest "Check that varnishtest is actually a valid command"
+ * vtest "Check that vtest is actually a valid command"
*
* It will also print that string in the log.
*/
+void v_matchproto_(cmd_f)
+cmd_vtest(CMD_ARGS)
+{
+
+ (void)priv;
+ (void)cmd;
+ (void)vl;
+
+ if (av == NULL)
+ return;
+ AZ(strcmp(av[0], "vtest"));
+
+ vtc_log(vl, 1, "TEST %s", av[1]);
+ AZ(av[2]);
+}
+
+/* SECTION: varnishtest varnishtest
+ *
+ * Alternate name for 'vtest', see above.
+ *
+ */
+
void v_matchproto_(cmd_f)
cmd_varnishtest(CMD_ARGS)
{
More information about the varnish-commit
mailing list