CVS commit: src/tests/lib/libcurses/director

2024-07-18 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Thu Jul 18 22:10:51 UTC 2024

Modified Files:
src/tests/lib/libcurses/director: director.c testlang_parse.y

Log Message:
Add a nofail (-n) option so that the director will not exit when the
test output does not match the check file.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/tests/lib/libcurses/director/director.c
cvs rdiff -u -r1.54 -r1.55 src/tests/lib/libcurses/director/testlang_parse.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libcurses/director/director.c
diff -u src/tests/lib/libcurses/director/director.c:1.29 src/tests/lib/libcurses/director/director.c:1.30
--- src/tests/lib/libcurses/director/director.c:1.29	Thu Jun 10 07:21:07 2021
+++ src/tests/lib/libcurses/director/director.c	Thu Jul 18 22:10:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: director.c,v 1.29 2021/06/10 07:21:07 mcf Exp $	*/
+/*	$NetBSD: director.c,v 1.30 2024/07/18 22:10:51 blymn Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -57,6 +57,7 @@ saved_data_t  saved_output;	/* In testla
 int to_slave;
 int from_slave;
 int master;			/* pty to the slave */
+int nofail;			/* don't exit on check file fail */
 int verbose;			/* control verbosity of tests */
 int check_file_flag;		/* control check-file generation */
 const char *check_path;		/* path to prepend to check files for output
@@ -136,10 +137,11 @@ main(int argc, char *argv[])
 	int pipe_to_slave[2], pipe_from_slave[2];
 
 	termpath = term = slave = NULL;
+	nofail = 0;
 	verbose = 0;
 	check_file_flag = 0;
 
-	while ((ch = getopt(argc, argv, "vgfC:s:t:T:")) != -1) {
+	while ((ch = getopt(argc, argv, "nvgfC:s:t:T:")) != -1) {
 		switch (ch) {
 		case 'C':
 			check_path = optarg;
@@ -147,6 +149,9 @@ main(int argc, char *argv[])
 		case 'T':
 			termpath = optarg;
 			break;
+		case 'n':
+			nofail = 1;
+			break;
 		case 's':
 			slave = optarg;
 			break;

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.54 src/tests/lib/libcurses/director/testlang_parse.y:1.55
--- src/tests/lib/libcurses/director/testlang_parse.y:1.54	Sun Dec 10 15:51:13 2023
+++ src/tests/lib/libcurses/director/testlang_parse.y	Thu Jul 18 22:10:51 2024
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.54 2023/12/10 15:51:13 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.55 2024/07/18 22:10:51 blymn Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -55,6 +55,7 @@ extern int master;
 extern struct pollfd readfd;
 extern char *check_path;
 extern char *cur_file;		/* from director.c */
+extern int nofail;		/* from director.c */
 
 int yylex(void);
 
@@ -1004,7 +1005,7 @@ compare_streams(const char *filename, bo
 	data, (data >= ' ' )? data : '-');
 		}
 
-		if (!create_check_file && ref != data) {
+		if (!nofail && !create_check_file && ref != data) {
 			errx(2, "%s:%zu: refresh data from slave does "
 			"not match expected from file %s offset %zu "
 			"[reference 0x%02x (%c) != slave 0x%02x (%c)]",
@@ -1029,7 +1030,7 @@ compare_streams(const char *filename, bo
 	}
 
 	/* discard any excess saved output if required */
-	if (discard) {
+	if (discard || nofail) {
 		saved_output.count = 0;
 		saved_output.readp = 0;
 	}



CVS commit: src/tests/lib/libcurses/director

2024-07-18 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Thu Jul 18 22:10:51 UTC 2024

Modified Files:
src/tests/lib/libcurses/director: director.c testlang_parse.y

Log Message:
Add a nofail (-n) option so that the director will not exit when the
test output does not match the check file.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/tests/lib/libcurses/director/director.c
cvs rdiff -u -r1.54 -r1.55 src/tests/lib/libcurses/director/testlang_parse.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libcurses/director

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 18:04:55 UTC 2023

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l

Log Message:
tests/libcurses: require 3 digits in octal character escapes

Previously, the string literal "\0" had been interpreted as "0", which
would have made the backslash redundant.  The tests don't use this form.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/lib/libcurses/director/testlang_conf.l

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libcurses/director

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 18:04:55 UTC 2023

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l

Log Message:
tests/libcurses: require 3 digits in octal character escapes

Previously, the string literal "\0" had been interpreted as "0", which
would have made the backslash redundant.  The tests don't use this form.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/lib/libcurses/director/testlang_conf.l

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libcurses/director/testlang_conf.l
diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.26 src/tests/lib/libcurses/director/testlang_conf.l:1.27
--- src/tests/lib/libcurses/director/testlang_conf.l:1.26	Mon Nov 15 21:45:46 2021
+++ src/tests/lib/libcurses/director/testlang_conf.l	Sun Dec 10 18:04:55 2023
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_conf.l,v 1.26 2021/11/15 21:45:46 blymn Exp $ 	*/
+/*	$NetBSD: testlang_conf.l,v 1.27 2023/12/10 18:04:55 rillig Exp $ 	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -86,7 +86,11 @@ dequote(const char *s, size_t *len)
 	(p[2] - '0');
 	p += 3;
 } else {
-	*q++ = *p++;
+	errx(2,
+	"%s:%zu: Invalid escape sequence "
+	"'\\%c' in string literal; octal "
+	"numbers must be 3 digits wide",
+	cur_file, line, *p);
 }
 continue;
 			}



CVS commit: src/tests/lib/libcurses/director

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 15:51:13 UTC 2023

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: constify


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/tests/lib/libcurses/director/testlang_parse.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libcurses/director

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 15:51:13 UTC 2023

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: constify


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/tests/lib/libcurses/director/testlang_parse.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.53 src/tests/lib/libcurses/director/testlang_parse.y:1.54
--- src/tests/lib/libcurses/director/testlang_parse.y:1.53	Sun Jun 13 11:06:20 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Dec 10 15:51:13 2023
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.53 2021/06/13 11:06:20 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.54 2023/12/10 15:51:13 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -141,7 +141,7 @@ static void	save_slave_output(bool);
 static void	validate_type(data_enum_t, ct_data_t *, int);
 static void	set_var(data_enum_t, const char *, void *);
 static void	validate_reference(int, void *);
-static char *	numeric_or(char *, char *);
+static char *	numeric_or(const char *, const char *);
 static char *	get_numeric_var(const char *);
 static void	perform_delay(struct timespec *);
 static void	set_cchar(char *, void *);
@@ -517,7 +517,7 @@ get_numeric_var(const char *var)
  * Perform a bitwise OR on two numbers and return the result.
  */
 static char *
-numeric_or(char *n1, char *n2)
+numeric_or(const char *n1, const char *n2)
 {
 	unsigned long i1, i2, result;
 	char *ret;



CVS commit: src/tests/lib/libcurses/director

2021-11-15 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Mon Nov 15 21:45:47 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l

Log Message:
Add handling for backspace special character (\b)


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/tests/lib/libcurses/director/testlang_conf.l

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libcurses/director/testlang_conf.l
diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.25 src/tests/lib/libcurses/director/testlang_conf.l:1.26
--- src/tests/lib/libcurses/director/testlang_conf.l:1.25	Thu Feb 25 00:50:10 2021
+++ src/tests/lib/libcurses/director/testlang_conf.l	Mon Nov 15 21:45:46 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_conf.l,v 1.25 2021/02/25 00:50:10 rillig Exp $ 	*/
+/*	$NetBSD: testlang_conf.l,v 1.26 2021/11/15 21:45:46 blymn Exp $ 	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -92,6 +92,12 @@ dequote(const char *s, size_t *len)
 			}
 
 			switch (*p) {
+			case 'b':
+/* backspace */
+*q++ = '\b';
+p++;
+break;
+
 			case 'e':
 /* escape */
 *q++ = '\e';



CVS commit: src/tests/lib/libcurses/director

2021-11-15 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Mon Nov 15 21:45:47 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l

Log Message:
Add handling for backspace special character (\b)


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/tests/lib/libcurses/director/testlang_conf.l

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/tests/lib/libcurses/director

2021-04-05 Thread Valery Ushakov
On Tue, Apr 06, 2021 at 00:47:00 +, Roland Illig wrote:

> The previous "table" was an insult to any reader.  It was unsorted,
> listed the functions shuffled, and was not even formatted consistently.

That's pretty rude.  Please, tone down your commit "messages".


-uwe


CVS commit: src/tests/lib/libcurses/director

2019-06-11 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Tue Jun 11 10:22:35 UTC 2019

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
Bracket strings being validated with markers to ensure sneaky whitespeace
is noticed.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/lib/libcurses/director/testlang_parse.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.14 src/tests/lib/libcurses/director/testlang_parse.y:1.15
--- src/tests/lib/libcurses/director/testlang_parse.y:1.14	Sun Jan  4 20:19:46 2015
+++ src/tests/lib/libcurses/director/testlang_parse.y	Tue Jun 11 10:22:35 2019
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.14 2015/01/04 20:19:46 christos Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.15 2019/06/11 10:22:35 blymn Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -1239,12 +1239,12 @@ validate_return(const char *expected, co
 {
 	if (((check == 0) && strcmp(expected, value) != 0) ||
 	((check == 1) && strcmp(expected, value) == 0))
-		errx(1, "Validate expected %s %s %s line %zu of file %s",
+		errx(1, "Validate expected >%s< %s >%s< line %zu of file %s",
 		expected,
 		(check == 0)? "matching" : "not matching", value,
 		line, cur_file);
 	if (verbose) {
-		fprintf(stderr, "Validated expected value %s %s %s "
+		fprintf(stderr, "Validated expected value >%s< %s >%s< "
 		"at line %zu of file %s\n", expected,
 		(check == 0)? "matches" : "does not match",
 		value, line, cur_file);