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 <bl...@netbsd.org>
@@ -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 <bl...@netbsd.org>
@@ -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;
 	}

Reply via email to