From 5f46c18318b86ef0893e9ea8278cd57039cf2ec9 Mon Sep 17 00:00:00 2001 From: anton Date: Sat, 10 Jul 2021 07:10:31 +0000 Subject: [PATCH] minor nits: * compile the edit utility once * emit a warning during timeout --- regress/bin/ksh/edit/Makefile | 13 ++++++++----- regress/bin/ksh/edit/edit.c | 8 +++++--- regress/bin/ksh/edit/subr.sh | 4 ++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/regress/bin/ksh/edit/Makefile b/regress/bin/ksh/edit/Makefile index 241e9506402..a086941a0a2 100644 --- a/regress/bin/ksh/edit/Makefile +++ b/regress/bin/ksh/edit/Makefile @@ -1,6 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2017/08/22 20:14:57 anton Exp $ - -REGRESS_TARGETS= emacs vi +# $OpenBSD: Makefile,v 1.5 2021/07/10 07:10:31 anton Exp $ KSH= /bin/ksh @@ -8,10 +6,15 @@ PROG= edit CFLAGS+= -Wall LDADD+= -lutil -emacs: edit +REGRESS_SETUP_ONCE= ${PROG} + +REGRESS_TARGETS+= emacs +REGRESS_TARGETS+= vi + +emacs: sh ${.CURDIR}/emacs.sh ${.CURDIR} ${KSH} -vi: edit +vi: sh ${.CURDIR}/vi.sh ${.CURDIR} ${KSH} .include diff --git a/regress/bin/ksh/edit/edit.c b/regress/bin/ksh/edit/edit.c index 17bae5c266f..7b49f371ab6 100644 --- a/regress/bin/ksh/edit/edit.c +++ b/regress/bin/ksh/edit/edit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: edit.c,v 1.7 2017/11/21 19:22:45 anton Exp $ */ +/* $OpenBSD: edit.c,v 1.8 2021/07/10 07:10:31 anton Exp $ */ /* * Copyright (c) 2017 Anton Lindqvist * @@ -84,7 +84,7 @@ main(int argc, char *argv[]) err(1, "signal: SIGINT"); memset(&ws, 0, sizeof(ws)); - ws.ws_col = 80, + ws.ws_col = 80; ws.ws_row = 24; pid = forkpty(&ptyfd, NULL, NULL, &ws); @@ -111,8 +111,10 @@ main(int argc, char *argv[]) err(1, "poll"); } if (nready == 0) { - if (timeout == PRTIM) + if (timeout == PRTIM) { + warnx("timeout waiting from prompt"); ret = 1; + } break; } if (pfd.revents & (POLLERR | POLLNVAL)) diff --git a/regress/bin/ksh/edit/subr.sh b/regress/bin/ksh/edit/subr.sh index b24253d6d69..5a5e9483e9c 100644 --- a/regress/bin/ksh/edit/subr.sh +++ b/regress/bin/ksh/edit/subr.sh @@ -1,4 +1,4 @@ -# $OpenBSD: subr.sh,v 1.8 2017/11/21 19:25:46 anton Exp $ +# $OpenBSD: subr.sh,v 1.9 2021/07/10 07:10:31 anton Exp $ # # Copyright (c) 2016 Ingo Schwarze # Copyright (c) 2017 Anton Lindqvist @@ -18,7 +18,7 @@ testseq() { stdin=$1 exp=$(echo "$2") - act=$(echo -n "$stdin" | ./edit -p "$PS1" ${KSH:-/bin/ksh} -r 2>&1) + act=$(echo -n "$stdin" | ./edit -p "$PS1" -- ${KSH:-/bin/ksh} -r 2>&1) [ $? = 0 ] && [ "$exp" = "$act" ] && return 0 dump input "$stdin" -- 2.20.1