Unfortunately the previous solution was too naive and misidentified
some errors.
In essence, passing regex-source couldn't work, because those could
not match any other line, so we have to inject regex-matching into the
SequenceMatcher.
Through awful hackery, this is possible.
Updates littlecheck to 0f6841bbc1674e89f512b5f19d1ad4e0227d2934.
This lets littlecheck "diff" the given output with the checks, leading
to easier to understand errors.
E.g. changing some random lines in andandoror.fish yields error output
like:
```
Testing file checks/andandoror.fish ... Failure:
The CHECK on line 36 wants:
if test 4 ok
which failed to match line stdout:9:
if test 3 ok
Context:
[...] from line 17 (stdout:6):
true && false || true: 0
if test 1 ok
if test 2 ok
if test 3 ok <= no check matches this, previous check on line 35
if test 4 ok
0 0 0
1 1 1
2 2 2
3 3 3 <= does not match CHECK '3 5 3' on line 55
4 4 4
0
1
[...] from line 126 (stdout:33):
0
0
0
<= nothing to match CHECK 'banana' on line 135
when running command:
../test/root/bin/fish checks/andandoror.fish
```
This updates littlecheck to b9c24a3.
This was using "/usr/local/bin/fish" for no good reason - 1. fish
might not be installed, 2. fish might not be installed *there*.
Just use /bin/sh in this case, if that doesn't exist we have bigger
problems, and this is just a simple wrapper for a command call.
[ci skip]
In #7459, asan printed error output. However, because we had a failure
on stdout already, littlecheck would only print the first unmatched
line from stderr, leading to output like
```
additional output on stderr:1:
=================================================================
```
Which is of course entirely useless.
So in that case we just let it print *all* unmatched stderr lines, so
you'd get the full asan output, which presumably is of more use.
This upgrades littlecheck to 5f7deafcea4e58dd3d369eae069a3781bb6ce75e.
Instead of using /tmp/fish as a temporary directory for this operation,
which could lead to clobbering user files, use mktemp to create an
actual temporary directory.
Ensure that the increment= param is set via keyword, not via positional arg.
This mistake was masking a bug where the "^a b c" match was not being tested,
because it was being set as the value for increment!
This switches the 'increment' param from "after" to "before." Instead
of expect_prompt saying if the next prompt will be incremented, each
call site says if it should have been incremented sinec the last prompt.
The result is just the *index* of the pattern that matched. But since
we never pass a *list* it's just always 0.
spawn.match is the MatchObject that produced the match, so it can be
used to post-process the matched output, e.g.
```python
m = expect_re('\d+')
m.group() # is now the matched number
```
Prior to this change, if we saw more than one repaint readline command in
a row, we would try to ignore the second one. However this was never the
right thing to do since sometimes we really do need to repaint twice in a
row (e.g. the user hits Ctrl+L twice). Previously we were saved by the
buginess of this mechanism but with the repainting refactoring we see
missing redraws.
Remove the coalescing logic and add a test. Fixes#7280.
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.
This was sometimes slightly annoying in porting.
5 is enough most of the time, 10 should be enough basically always,
without being too annoying if you don't need it.
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.
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.
Commit b2f40783a2b5b0663409c4daa90b794b02dd37a6
This has better progress reporting, and the exit status of littlecheck
indicates how many test failures there were.
Mostly line breaks, one instance of tabs!
For some reason clang-format insists on two spaces before a same-line comment?
(I continue to be unimpressed with super-strict line length limits,
but I continue to believe in automatic styling, so it is what it is)
[ci skip]
This allows:
- Running scripts via shebang (not important here)
- Progress output (so we can ditch more of our run script)
- Context (only after, for now) - this is important if there is a test failure
It's now good enough to do so.
We don't allow grid-alignment:
```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z -a '(something)'
```
becomes
```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z -a '(something)'
```
It's just more trouble than it is worth.
The one part I'd change:
We align and/or'd parts of an if-condition with the in-block code:
```fish
if true
and false
dosomething
end
```
becomes
```fish
if true
and false
dosomething
end
```
but it's not used terribly much and if we ever fix it we can just
reindent.
$GIT_DIR is interpreted by git as an environment variable, pointing at the
.git directory. If git_version_gen.sh is run in an environment with an
exported GIT_DIR, it will re-export GIT_DIR to point at the fish source
directory. This will cause git operations to fail.
This could be reproduced as building fish as part of an interactive rebase
'exec' command. git_version_gen.sh would always fail!
Closes#6435.
close_fds=True is actually the default in Python 2.7 and 3.2, but not in
ancient (but still in production in Red Hat Enterprise Linux 6) Python
2.6. Enable it there as well.
Allows `fish_indent -w **.fish` to restyle all fish files under the
current directory.
(This also has the sideeffect of reducing style.fish time by ~10s, as
we only need to invoke `fish_indent` once, instead of once per-file)
This used "argparse" to parse the args, which broke since CXXFLAGS
contained options.
Instead we pass "--all" before any other arguments, and then stop
argparse at nonoptions.
Came in handy for tracking down the performance regression in #5219. This will
take the output of two (necessarily identical) `fish --profile ...` runs and
produce a third profile log in which all times are the difference between the
first and the second profile provided.
(I'm not sure if build_tools is the right place for it, but I think it's OK?)
I can't seem to find a reason why the shell interpreter needs to be bash
and not just sh here. Needed to replace `BASH_SOURCE[0]` with the legacy
`$0` supported by sh, but otherwise it seems to still work.
Many non-Linux platforms do not ship with bash out-of-the-box (and as a
shell, I don't think we need to encourage the further proliferation of
bash ;-), this lets fish build on a clean install of FreeBSD, which does
not have bash.
This fixes a variety of issues related to building the documentation
with CMake. In particular it cleans up the dependency management and
fixes some issues where the documentation build was using generated
files from the source directory.
This untangles the CMake versioning issues (I hope) as discussed in #4626.
Note most of the advice found on the Internet about how to inject git
versions into CMake is just wrong.
The behavior we want is to unconditionally run the script
build_tools/git_version_gen.sh at build time (i.e. when you invoke ninja or
make, and not when you invoke cmake, which is build system generation time).
This script is careful to only update the FISH-BUILD-VERSION-FILE if the
contents have changed, to avoid spurious rebuilding dependencies of
FISH-BUILD-VERSION-FILE. Assuming the git version hasn't changed, the script
will run, but not update FISH-BUILD-VERSION-FILE, and therefore
fish_version.o will not have to be rebuilt.
This might normally rebuild more than is necessary even if the timestamp is
not updated, because ninja computes the dependency chain ahead of time. But
Ninja also supports the 'restat' option for just this case, and CMake is rad
and exposes this via BYPRODUCTS. So mark FISH-BUILD-VERSION-FILE as a
byproduct and make the script always update a dummy file
(fish-build-version-witness.txt). Note this is the use case for which
BYPRODUCTS is designed.
We also have fish_version.cpp #include "FISH-BUILD-VERSION-FILE", and do a
semi-silly thing and make FISH-BUILD-VERSION-FILE valid C++ (so there's just
one version file). This means we have to filter out the quotes in other
cases..
This reverts commit 25839b8c36.
This was an attempt to simplify the version generation, but it
computed the version at build sytem generation time rather than
at build time, requiring another run of CMake to update it.
Correctly generate FISH_BUILD_VERSION for use in fish_version.h/cpp and
fish.pc to allow `fish --version` and `echo $version` to work again.
Not needing the same convoluted measures used by Makefile builds to
prevent the regeneration of the fish version file when it hasn't
changed.
Purposely created a new `cmake_git_version_gen.sh` file so that the old
`git_version_gen.sh` remains compatible with the existing Makefile build
script. Same reason why `fish.pc.in` was not modified to use a lowercase
variable name to match the CMAKE variable of the same name.
Closes#4626
Command name continues twice in man page.
Current version's example:
NAME
andand - conditionally execute a command
Fixed version:
NAME
and - conditionally execute a command