Commit Graph

850 Commits

Author SHA1 Message Date
Fabian Homborg
2cdd6df257 fish_indent: Add a "--check" option to only test indentation
Fixes #7251.
2020-08-08 20:23:14 +02:00
Fabian Homborg
b4f5ba6537 tests: Exit: Try sleeping multiple times 2020-08-08 16:35:08 +02:00
Fabian Homborg
7c0ecf0d37 Increase job summary timeout more in one call 2020-08-08 16:35:08 +02:00
Fabian Homborg
46faf0869c tests: Stop sleeping before expect
It's useless - `expect` has a timeout anyway, and it defaults to 5s,
so these 0.5s sleeps just mean it'll always take at least 0.5s.

Sometimes it is useful to let things settle before *sending* text, and
it would be nice to be able to set the timeout for each expect
separately, but just adding to the timeout isn't useful.
2020-08-08 16:35:08 +02:00
Fabian Homborg
7de333f839 tests: jobs: Sleep more
This one sometimes fails with a zombie detected, so I'm assuming it's
too fast for reaping to happen, so we add another 100ms sleep.

Yeah, this isn't great but...eh
2020-08-08 16:35:08 +02:00
Fabian Homborg
05ddbb1d2e tests: Add an additional "sleep"
This sometimes fails on Travis because sending things to the
background can take a while
2020-08-08 16:35:08 +02:00
Fabian Homborg
f63d70298f tests: Use ps -o stat instead of "state"
Oh, Alpine
2020-08-07 21:06:16 +02:00
Johannes Altmanninger
b947e360db Allow newlines after && and ||
We do the same for pipes (#1285). This matches POSIX sh behavior.
2020-08-06 21:24:26 +02:00
Soumya
539e6fe8b1 Return no status from successful variable assignments 2020-08-05 12:23:49 -07:00
Soumya
a2b2bcef6e Add a $status_generation variable that's incremented for each interactive command that produces a status.
This can be used to determine whether the previous command produced a real status, or just carried over the status from the command before it. Backgrounded commands and variable assignments will not increment status_generation, all other commands will.
2020-08-05 12:23:49 -07:00
ridiculousfish
290236f7e7 Attempt to fix the fg pexpect test
Hypothesize that ^Z is being sent too quickly and add a sleep.
2020-07-31 15:31:55 -07:00
ridiculousfish
c35fe879c7 Bravely remove reclaim... param from continue_job, and rework tcsetpgrp calls
This changes how fish attempts to protect itself from calling tcsetpgrp() too
aggressively. Recall that tcsetpgrp() will "force" itself, if SIGTTOU is
ignored (which it is in fish when job control is enabled).

Prior to this fix, we avoided SIGTTINs by only transferring the tty ownership
if fish was already the owner. This dated from a time before we had really
nailed down how pgroups should be assigned. Now we more deliberately assign a
job's pgroup so we don't need this conservative check.

However we still need logic to avoid transferring the tty if fish is not the
owner. The bad case is when job control is enabled while fish is running in the
background - here fish would transfer the tty and "steal" from the foreground
process.

So retain the checks of the current tty owner but migrate them to the point of
calling tcsetpgrp() itself.
2020-07-27 14:51:37 -07:00
Fabian Homborg
84b25855b0 alias: Escape the first word again
See https://stackoverflow.com/questions/63115744/alias-with-spaces-and-arguments-in-fish-3

This was broken in 115892ccd2
2020-07-27 17:19:44 +02:00
David Adam
2c5d4937e3 disown: add tests for disowned jobs in scripts 2020-07-25 20:38:59 -05:00
Fabian Homborg
a30630a1df Add some rudimentary fg tests
See #5451
2020-07-21 20:31:32 +02:00
Fabian Homborg
825f821623 Pexpects: Increase a timeout
This failed on sr.ht's FreeBSD machines once.
2020-07-21 20:27:55 +02:00
Fabian Homborg
276c76a363 Test alias with a --option
Closes #4756.
2020-07-14 21:08:47 +02:00
Fabian Homborg
9256f37e9e Add test for redirection to variable
Closes #6443
2020-07-14 20:55:38 +02:00
Fabian Homborg
fec3a593a2 test.fish: Erase more environment variables
Unfortunately this doesn't quite fix the issue with Pantheon
Terminal (#7913), as that somehow manages to re-set $VTE_VERSION by
the time littlecheck runs.
2020-07-13 20:55:39 +02:00
ridiculousfish
886603b2ca Adopt the new AST in fish_indent
This switches fish_indent from parsing with parse_tree
to the new ast.

This is the most difficult transition because the new ast retains less
lexical information than the old parse tree. The strategy is:

1. Use parse_util_compute_indents to compute indenting for each token.

2. Compute the "gap text" between the text of significant tokens. This
contains whitespace, comments, etc.

3. "Fix up" the gap text while leaving the significant tokens alone.
2020-07-04 14:58:05 -07:00
Mahmoud Al-Qudsi
f0580b4970 [tests] Fix test to reflect whitespace changes to error message 2020-06-25 23:19:44 -05:00
Mahmoud Al-Qudsi
d0afae46ce [tests] Do not rely on env output to be sorted alphabetically 2020-06-25 21:41:06 -05:00
Fabian Homborg
149a0b98af Another formatting run
I really kinda hate how insistent clang-format is to have line
breaks *IFF THE LINE IS TOO LONG*.

Like... lemme just add a break if it looks better, will you?

But it is the style at this time, so we shall tie an onion to our
belt.
2020-06-24 20:43:56 +02:00
Fabian Homborg
a121833e88 argparse: Only print stacktrace when it's an error in argparse usage
A broken/missing optspec or `--` is a bug in the script using
argparse, an unknown option or invalid argument is a bug in using that script.

So in the former case print a stacktrace, because the person writing
the `argparse` call is at fault, in the latter don't.

Fixes #6703.
2020-06-17 20:05:48 +02:00
Fabian Homborg
00f7cdae62 tests: Don't send \cA
Breaks the tests in screen.

Fixes #7111.
2020-06-17 15:55:31 +02:00
Fabian Homborg
52a6574751 tests: Use status dirname 2020-06-14 19:30:03 +02:00
Fabian Homborg
e0f5fc2cb4 Remove some leftover test files 2020-06-13 20:43:12 +02:00
Fabian Homborg
aa7316b6c6 checks/read: Print maximum if we fail to read it
Debugging here is a bit difficult.
2020-06-13 19:53:21 +02:00
Fabian Homborg
87a1e4f8b9 Remove expect
This should remove the last bits of expect from the codebase.
2020-06-13 19:28:42 +02:00
Fabian Homborg
c6dffa226f Port history test to pexpect 2020-06-13 19:24:36 +02:00
Fabian Homborg
51e3258dbe Port histfile test to pexpect 2020-06-13 18:53:01 +02:00
Fabian Homborg
25a73a77bb Unset X-bit on tests
These files are not expected to be run directly.
2020-06-13 16:18:17 +02:00
Fabian Homborg
93c3aaf5f4 Port signals test to pexpect 2020-06-13 15:38:54 +02:00
Fabian Homborg
c11457f2db Port job_summary test to pexpect 2020-06-13 15:21:40 +02:00
Fabian Homborg
a6a1c6e775 Port read tests to expect
Note: This includes a super cheesy thing to print variable contents.
The expect version has one that's a bit more elaborate (featuring a
marker setup), but tbh that doesn't seem to be worth it.

If we do need it, we can add it, but it seems more likely we'd just do
`set -S`, or do it in a check instead.
2020-06-13 15:21:40 +02:00
Fabian Homborg
aafdaea2f9 Port wait test to pexpect 2020-06-13 15:21:40 +02:00
Fabian Homborg
15a789dda0 Fix fkr tests
I had fish_key_reader *installed*, so this worked for me.

But really we have the path in $fish_key_reader, so we want to use
that variable.
2020-06-08 23:19:57 +02:00
Fabian Homborg
f66edfdec2 Port generic.expect to pexpect
Removes a dumb workaround. Huzzah!
2020-06-08 22:57:46 +02:00
Fabian Homborg
339a5a2196 Port fkr expect to pexpect 2020-06-08 22:52:18 +02:00
Fabian Homborg
cbefdb775d tests: Sleep for a bit
Gosh dangit Travis
2020-06-08 18:49:03 +02:00
Fabian Homborg
83808929a7 Remove pipestatus expect test
This doesn't really do more than the check of the same name.
2020-06-08 17:34:43 +02:00
Fabian Homborg
10fbdd34e7 Reformat pexpects
These are now python scripts
2020-06-08 17:33:04 +02:00
Fabian Homborg
3c6055c3e0 Move exit test to pexpect
This needs some subprocess magic, but otherwise it's nicely straightforward.
2020-06-08 17:31:18 +02:00
Fabian Homborg
9d523c7589 Move complete test to pexpect 2020-06-08 17:16:09 +02:00
Fabian Homborg
927aa60349 Move bind_mode_events test to pexpect 2020-06-08 17:12:49 +02:00
Fabian Homborg
7076880da9 Move commandline test to pexpect 2020-06-08 17:09:29 +02:00
ridiculousfish
8a27873598 Remove redundant expect tests
With the new pexpect based framework, bind and pipeline expect tests can
be removed.

Amusingly the complete.fish check required the existence of bind.expect.
Fix the check at the same time.
2020-06-07 14:53:17 -07:00
ridiculousfish
4ae4314e63 Improve pexpect output
Make it easier to use pexpect and to understand its error messages.
Switch to a style in tests using bound methods, which makes them
less noisy to write.
2020-06-07 14:53:17 -07:00
ridiculousfish
3b7feb38e9 Add pexpect-based interactive testing framework
This adds a new interactive test framework based on Python's pexpect. This
is intended to supplant the TCL expect-based tests.

New tests go in `tests/pexpects/`. As a proof-of-concept, the
pipeline.expect test and the (gnarly) bind.expect test are ported to the
new framework.
2020-06-07 14:46:21 -07:00
Fabian Homborg
9d2bf248ee test: Add tests for error messages 2020-06-07 16:23:29 +02:00