result = lex_end_of_command (lexer);
lex_discard_rest_of_command (lexer);
+ if (nesting_level != SIZE_MAX)
+ output_close_groups (nesting_level);
+
if (result != CMD_EOF && result != CMD_FINISH)
while (lex_token (lexer) == T_ENDCMD)
lex_get (lexer);
- if (nesting_level != SIZE_MAX)
- output_close_groups (nesting_level);
-
return result;
}
tests/language/commands/readnames.ods \
tests/language/commands/nhtsa.sav \
tests/language/commands/llz.zsav \
+ tests/ui/terminal/squish-pty.py \
tests/utilities/regress.spv
CLEANFILES += *.save pspp.* foo*
define.sps:1-3: inside the expansion of `!macro',
define.sps:1-3: inside the expansion of `!macro',
define.sps:1-3: inside the expansion of `!macro',
-define.sps:4.1-4.6: error: DEFINE: Maximum nesting level 50 exceeded. (Use SET MNEST to change the limit.)
+define.sps:4.1-4.6: error: Maximum nesting level 50 exceeded. (Use SET MNEST to change the limit.)
4 | !macro.
| ^~~~~~"
AT_CHECK([pspp show.sps -O box=unicode], [0], [dnl
SET PRINTBACK=ON.
+
SHOW SPLIT.
Settings
3 33 Three
END DATA.
+
REGRESSION
/VARIABLES= a
AT_CLEANUP
AT_SETUP([SIGSEGV yields error report])
-
# This test intentionally causes SIGSEGV, so make Address Sanitizer ignore it.
ASAN_OPTIONS=$ASAN_OPTIONS:handle_segv=0; export ASAN_OPTIONS
AT_CHECK([sed '/proximate/q' < stderr], [0], [expout])
AT_CLEANUP
-
dnl This tests for a crash which was observed with --syntax
AT_SETUP([argument parsing])
])
AT_CHECK([pspp --syntax=enhanced main.sps], [0], [ignore])
+AT_CLEANUP
+dnl Bug #63910 reported that command output was delayed until the
+dnl next command was supplied. This checks for regression against
+dnl that bug.
+AT_SETUP([interactive output appears immediately])
+dnl We have to use squish-pty to make PSPP think that we're running
+dnl interactively. First make sure that squish-pty works at all.
+SQUISH_PTY="$PYTHON3 $top_srcdir/tests/ui/terminal/squish-pty.py"
+AT_CHECK([$SQUISH_PTY true </dev/null >/dev/null 2>/dev/null || exit 77])
+dnl Then do the real test. The crucial thing to notice here is
+dnl that the SHOW output must appear before the prompt for FINISH.
+AT_CHECK([echo 'SHOW N.
+FINISH.' | $SQUISH_PTY pspp], [0], [stdout])
+AT_CHECK([sed -n 's/\r$//
+/^PSPP>/,$p' stdout], [0], [dnl
+PSPP> SHOW N.
+ Settings
++-+-------+
+|N|Unknown|
++-+-------+
+PSPP> FINISH.
+])
AT_CLEANUP
--- /dev/null
+#! /usr/bin/python3
+import os
+import pty
+import signal
+import sys
+
+def main(args):
+ if len(args) < 2:
+ sys.stderr.write('''\
+usage: squish-pty COMMAND [ARG]...
+Squishes both stdin and stdout into a single pseudoterminal and
+passes it as stdin and stdout to the specified COMMAND.
+''')
+ return 1
+
+ status = pty.spawn(args[1:])
+ if os.WIFEXITED(status):
+ return os.WEXITSTATUS(status)
+ elif os.WIFSIGNALED(status):
+ signal.raise_signal(os.WTERMSIG(status))
+ else:
+ assert False
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
+