Commit graph

234 commits

Author SHA1 Message Date
Johannes Altmanninger
516a70d9cb Misc cleanups
Some as suggested by lgtm.com
2021-03-21 19:41:36 +01:00
Fabian Homborg
81af5b7ff3 pexpect: Allow specifying that a test should fail
I have no idea how to see that flow control has worked otherwise
2021-02-15 17:30:50 +01:00
Fabian Homborg
ccc5e7cb28 pexpect: Pass on keyword arguments to spawn()
This is useful for all the additional pexpect features.
2021-02-12 18:21:07 +01:00
ridiculousfish
e4a993c581 Use xar-based workflow for creating Mac packages
As spotted in #7656, macOS installer files built on Big Sur fail signature
verification on macOS 10.11. This is because Big Sur productsign no longer
supplies the SHA-1 hash, and 10.11 does not know how to read the SHA-256
hash.

Replace the productsign flow with a flow based on
http://users.wfu.edu/cottrell/productsign/productsign_linux.html . This
uses the xar tool to digitally sign the installer packages, with both
SHA-1 and SHA-256 hashes.

The xar tool is somewhat tricky to build, so is checked in (as binary!)
compiled for Mac.

To build a Mac package, run make_pkg.sh (which invokes the signing flow)
followed by mac_notarize.sh which adds the notarization.
2021-01-31 14:07:49 -08:00
Fabian Homborg
5ca27ac565 Update littlecheck
From commit b1369a52c24336da2d2d6d5dc6707a7834065d43

This adds the "REQUIRES" directive that allows specifying
preconditions for tests, which allows us to add tests that don't have
to run on all systems.

Now, I don't want to just make all tests specific to an OS or
something, but e.g. a `git` test would be a honkin' great idea, and we
can't ask everyone to have `git`!
2021-01-16 13:26:01 +01:00
Johannes Altmanninger
a205225b4e lint.fish: properly handle -I and -D args for cppcheck
lint.fish receives arguments that contain multiple includes and defines.
As a result, we passed arguments like
"-I/usr/include -I$HOME/fish-shell/build -I/usr/include"
to cppcheck which interprets this as a single include directory.
This leads to errors like this one (because the "build" dir was missing):

	src/common.h:4:0: information: Include file: "config.h" not found. [missingInclude]
2020-12-29 16:31:43 +01:00
Johannes Altmanninger
53d922bde6 build_tools/lint.fish: correct cppcheck config location
Which was moved in 9b3bfb63d ("cppcheck: Move config files to build_tools")
Also get rid of the nonstandard cppcheck output format.
2020-12-29 16:31:43 +01:00
Johannes Altmanninger
84262b126b build_tools/style.fish: don't format other Python files 2020-12-29 16:31:43 +01:00
ridiculousfish
f4f7764390 Add Apple Silicon support to make_pkg
This checks in support for Apple Silicon builds in the Mac package maker
script.
2020-12-05 14:34:00 -08:00
Fabian Homborg
9567df4b15 Update littlecheck to 06457b194883879fe08282f84863fa37080c27a5
This fixes a bug where it would fail to match some regexes.
2020-11-30 18:16:42 +01:00
Fabian Homborg
6d98939445 Fix Littlecheck's diff-matcher
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.
2020-11-25 17:23:29 +01:00
Fabian Homborg
2e55e34544 Reformat 2020-11-22 14:39:48 +01:00
Fabian Homborg
47ddb6d516 Update littlecheck
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.
2020-11-22 11:28:12 +01:00
Fabian Homborg
236587774e cppcheck: Make less annoying
Force checking all #ifdef paths, disable StlAlgorithm
suggestion

Removes a lot of borderline useless spew.

[ci skip]
2020-11-15 12:41:55 +01:00
Fabian Homborg
9b3bfb63d3 cppcheck: Move config files to build_tools
It's weird having them in the parent directory.

Move them to build_tools/ and make them visible.

[ci skip]
2020-11-15 11:11:55 +01:00
Fabian Homborg
cb8ffb00d6 cppcheck.sh: Fix shebang
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]
2020-11-15 11:07:27 +01:00
Érico Rolim
ef4f3b7334 build_tools/list_committers_since: account for possibility of mktemp
failure.
2020-11-14 15:57:42 +01:00
Fabian Homborg
64b5a22274 Upgrade littlecheck to print all error lines
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.
2020-11-14 13:15:33 +01:00
Érico Rolim
3e3a42c127 build_tools/fish_xgettext.fish: use temporary directory.
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.
2020-11-13 16:29:37 +01:00
ridiculousfish
63cf3e972f Correct parameter order of pexpect.expect_prompt
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!
2020-10-06 16:03:06 -07:00
ridiculousfish
9e1800cb96 Rework increment param in pexpect.expect_prompt
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.
2020-10-06 14:22:35 -07:00
Johannes Altmanninger
f415b3b551 Update littlecheck
4a3e4c8 Allow inline #CHECK directives and ignore double-commented directives
2020-09-26 14:56:03 +02:00
Fabian Homborg
04562300e8 Pexpect: Return the match object instead of the result
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
```
2020-09-04 17:53:17 +02:00
ridiculousfish
47480b2dbd Remove redraw coalescing logic
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.
2020-08-24 13:22:35 -07:00
Fabian Homborg
31e19db64a Update littlecheck
Update littlecheck to dda885bed9d4a4c6ea1d9d66d0ca93fb54492b7c,
which also displays the context view when the error is on the first line.
2020-07-18 22:10:11 +02:00
Johannes Altmanninger
826db22dbf Adjust deprecated stderr redirection in fish_xgettext.fish 2020-07-05 08:55:11 +02: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
cfa2927610 pexpect: Show last 10 lines on failure
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.
2020-06-13 19:53:21 +02:00
Fabian Homborg
5478d979a0 pexpect: Consume color sequences in expect_prompt
We typically use TERM=dumb, but in some cases we need actual cursor
and color stuff.
2020-06-13 19:18:12 +02: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
9be510fa6b Update littlecheck
This used the wrong operator (`()` instead of `[]`) to look up in a dict.
2020-05-16 15:16:13 +02:00
Johannes Altmanninger
ec2371fb79 Some more precautionary uses of set --local 2020-05-15 21:35:48 +02:00
Johannes Altmanninger
49c5f96470 Use set -l to force use of a local variable
Bare set overwrites a global/universal variable if it exists.
2020-05-15 08:25:07 +02:00
Fabian Homborg
34a82dbff9 Update littlecheck to escape output 2020-04-26 14:39:46 +02:00
Lior Stern
d7aeac3c61 Add clang-tidy to build_tools/lint.fish 2020-04-04 14:47:58 -07:00
Fabian Homborg
edad6aa607 Update littlecheck
Now featuring Context display on error, which should make it a bit
easier to make out any problems.
2020-03-29 15:21:09 +02:00
ridiculousfish
11c1491e5a Import latest littlecheck
Commit b2f40783a2b5b0663409c4daa90b794b02dd37a6

This has better progress reporting, and the exit status of littlecheck
indicates how many test failures there were.
2020-03-15 17:45:11 -07:00
Fabian Homborg
9367d4ff71 Reindent functions to remove useless quotes
This does not include checks/function.fish because that currently
includes a "; end" in a message that indent would remove, breaking the test.
2020-03-09 19:46:43 +01:00
ridiculousfish
6721bf4031 Add the get-task-allow entitlement
This allows Mac fish to be debugged.
2020-02-29 15:29:50 -08:00
ridiculousfish
f6fc5afc59 Add a script to help notarize Mac build artifacts
This makes the Mac release process less painful.
2020-02-18 12:55:11 -07:00
ridiculousfish
d989ce72d0 Teach make_pkg.sh to codesign
It respects MAC_CODESIGN_ID and MAC_PRODUCTSIGN_ID variables.
2020-02-18 12:55:11 -07:00
Fabian Homborg
65883e0e40 Restyle
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]
2020-02-17 14:14:05 +01:00
David Adam
07ba0cb84a make_tarball: use XZ for compression
Closes #5460.
2020-02-14 22:00:38 +08:00
David Adam
6682f0e8ca make_pkg: use absolute source directories in all arguments 2020-02-11 14:26:00 +08:00
Fabian Homborg
f5a3a259dc Fix littlecheck on python 2 2020-01-25 15:31:10 +01:00
Fabian Homborg
25810b70f2 Update littlecheck
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
2020-01-25 11:54:42 +01:00
Fabian Homborg
69b464bc37 Run fish_indent on all our fish scripts
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.
2020-01-13 20:34:22 +01:00
ridiculousfish
4f3b3f7d61 Rename GIT_DIR to FISH_BASE_DIR in git_version_gen.sh
$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!
2019-12-16 19:18:56 -08:00
David Adam
5911fc94b8 littlecheck: pass close_fds to subprocess.Popen
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.
2019-12-15 21:48:55 +08:00