Commit Graph

303 Commits

Author SHA1 Message Date
Aaron Gyes
3b41f8dfe8 Add missing newlines 2022-01-26 13:51:45 -08:00
Aaron Gyes
a617ef7ec1 Fix typo in preinstall script. 2022-01-22 20:08:32 -08:00
Aaron Gyes
fe9822bb20 Fix welcome text, don't use logger.
Logger was unneccessary - stderr was being captured.

Do the welcome message as HTML - it's easier. Fixes #8661
2022-01-22 20:06:37 -08:00
Aaron Gyes
0d5651b0ab .pkg scripts: remove old installs, fix install volume, logging
+ Adds a preinstall script to wipe out whatever the last .pkg
   installed. This should avoid systems that have mad many updates
   getting into strange states autoloading things that no longer
   exist. Fixes #2963

 + Run add-shell with ${DSTVOLUME} prepended to the path - the
   installer lets users intall onto any volume, so it's plausible
   not installed onto /

 + Use `logger` instead of rando /tmp files for logging - stuff
   should show up in Console.

 + make_pkg makes the pkg and also fish.app - the former was being
   built with -j12 already, make the latter do so as well.
2022-01-21 14:01:06 -08:00
ridiculousfish
c1a1b70203 macOS: Specify hostArchitectures in osx_distribution.xml
This allows the installer to work without Rosetta 2 on Apple Silicon
Macs. Note that fish shell itself has run natively since 3.3.1 but the
installer still wanted Rosetta 2, because this key was missing.

Fixes #8566. Credit to floam for finding missing key.
2022-01-08 11:31:23 -08:00
ridiculousfish
667057cb0d macOS: go back to using Apple-provided productsign
Previously we used a hacked up 'xar' tool for signing packages,
since productsign produced a package that could not be installed on
macOS 10.11. That was fixed in Xcode 12.5 so we can just use Apple's
tools again.

See #7656.
Also see https://developer.apple.com/forums/thread/664842
2022-01-08 11:31:23 -08:00
Ilan Cosman
566a673e4f Run fish_indent on all non-test .fish files 2021-11-23 09:49:45 +01:00
ridiculousfish
e08b71592e pexpect_helper to unconditionally output to the tty
With the new test runner, pexpect_helper no longer sees a tty so wasn't
outputting the buffer. Just always do it.
2021-10-29 20:45:42 -07:00
ridiculousfish
f373e6e923 Reformat pexpect_helper.py with black 2021-10-29 20:42:59 -07:00
Aaron Gyes
901dbd71b0 fix build when path has spaces in it.
Now it works.
2021-10-22 02:27:19 -07:00
Mahmoud Al-Qudsi
86a442fb62 Make find_weak_odrs work with Python 3.6
`text` is an alias for `universal_newlines` but wasn't introduced until
Python 3.7
2021-10-04 19:45:36 -05:00
ridiculousfish
799a2abac1 Add script to detect ODR violations
This is a little script that can be run manually to try and detect ODR
violations. It works by looking for weak symbols in .o files where the
symbol has the same name and different sizes.
2021-09-30 11:33:03 -07:00
Fabian Homborg
f97eac55e8 Tell cppcheck we're c++11
Not "posix", wow.

Did anyone ever use this?
2021-09-15 17:49:57 +02:00
Fabian Homborg
23e6698dc8 cmake: Force color in the tests
For littlecheck/pexpect this just unconditionally enables color.

I have no idea what happens if you run cmake outside of a terminal
, but the worst that can happen is that *errors* have color
escapes in them.

If someone figures out how to get cmake to tell us if it's running in
a terminal, we can add a check.
2021-08-30 17:16:19 +02:00
Mahmoud Al-Qudsi
a6a3563a6e Update littlecheck to e6d56a with support for skipped tests
This is in preparation for adding skipped test support to our ctest
integration.
2021-08-29 08:56:12 +02:00
Fabian Homborg
f8a46c027d Add script to extract help sections
Unfortunately, we now need to know which .html file has which sections
to link to the correct one in help.fish.

So this script helps extract the sections from pre-built docs. It's
not supposed to be run at build time because

1. These change rarely.
2. We should link to the correct document even if the user doesn't
have the docs built.

And before anyone mentions it: This does *not* parse html with regex.

This "parses" the restricted subset of "class followed by href without
embedded quotes" that sphinx uses here in practice.
2021-08-23 18:01:31 +02:00
ridiculousfish
aad64ccdc0 Add some sleep to mac_notarize.sh
Notarization fails because you can't check on its status right away.
Add a sleep to address this.
2021-06-29 13:46:08 -07:00
David Adam
fd184cb4ea GitHub Actions: drop UBSan suppressions
These were only needed on Travis, and only worked there in this form.
2021-04-07 20:29:54 +08:00
Fabian Homborg
c8c641dd63 Update littlecheck to 5f6c024fbdf6654e7851d3fd756a6d56e167476e
Now with 52% fewer "command not found" errors
2021-03-26 19:32:14 +01:00
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
Rosen Penev
72bf267d96 make_pkg: Run through shellcheck
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-30 09:27:50 +01:00
Rosen Penev
9fe7efb82f git_version_gen: Run through shellcheck
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-30 09:27:50 +01:00
Rosen Penev
a755bc5cf6 make_tarball.sh: Run through shellcheck 2019-11-28 18:57:38 +01:00
Jason
3cf6ebc0e1 Amend typos and grammar errors 2019-11-25 13:07:15 +01:00
David Adam
66fd52aa15 fish_xgettext: update translation generation for new build system
Closes #6123.
2019-09-21 22:29:19 +08:00
Fabian Homborg
cc1388a78a Upgrade littlecheck to allow whitespace before comments
Necessary for test files that pass fish_indent.
2019-06-25 16:11:24 +02:00
ridiculousfish
476185748f Add littlecheck.py
This will be the new testing tool replacing the diff-based tests.

Imported from https://github.com/ridiculousfish/littlecheck
Version e28281273e54745c7d7aabeeb4b085af477d584b
2019-06-16 13:27:06 -07:00
Fabian Homborg
7ddae68645 Restyle a few stragglers
THERE WERE TABS! TABS!

TABS!

[ci skip]
2019-05-20 21:07:37 +02:00
Fabian Homborg
c2b7e9b2e6 fish_indent: Allow multiple file arguments
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)
2019-05-20 21:04:51 +02:00
Fabian Homborg
4078a3df26 build_tools/style.fish: Stop excluding completions
[ci skip]
2019-05-05 12:54:02 +02:00
Fabian Homborg
df7cb66ff9 build_tools/style: Make output a bit spicier.
COLORS! ALL THE COLORS! Well, three! No, wait, FOUR! But only if you
count "normal" as a color!

[ci skip]
2019-05-05 12:07:38 +02:00
Fabian Homborg
2b3f48d9ee build_tools/style.fish: Use black as python formatter
(Also renames the silly "$f_files" to "$fish_files")
2019-05-05 12:07:38 +02:00
ridiculousfish
36998eee55 Make more miscellaneous globals thread safe 2019-05-04 20:58:35 -07:00
ridiculousfish
18cecd3663 Beef up find_globals
Allow it to find the source declarations for globals, and ignore const ones.
2019-05-04 20:42:48 -07:00
Lily Ballard
aafd706a34 Replace Doxygen reference in README with Sphinx
Also update a comment in the `make_tarball.sh` script.
2019-03-31 21:39:03 +08:00
David Adam
83b4adffc0 make_pkg: get static version if git is not available 2019-02-28 21:08:02 +08:00
David Adam
ba64ec6e91 lint: drop CXX argument
The "fatal error: 'stddef.h' file not found" error is caused by incomplete installation of IWYU,
which can be fixed directly.

See https://github.com/include-what-you-use/include-what-you-use/issues/100
2019-02-28 22:03:57 +11:00
David Adam
a0f785c90f build_tools/style: drop guidance to use make 2019-02-28 22:03:57 +11:00
David Adam
e9b853e0c2 make_tarball: use cmake instead of Autotools for doc generation 2019-02-28 22:03:56 +11:00
Fabian Homborg
5e98259d95 autotools: Fix lint target
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.
2019-02-25 15:15:40 +01:00
ridiculousfish
c99fa08f21 Remove all of the documentation build helper scripts 2019-02-24 19:40:05 -08:00
David Adam
e461858964 travis: blacklist stl_tree from UBSan
Work on #2852.
2019-02-10 16:24:24 +08:00
ridiculousfish
23f8f1b6fb Remove some stale bits from make_pkg.sh 2019-02-05 22:14:43 -08:00
ridiculousfish
0f5dc0b4e2 Add --stdout param to git_version_gen.sh
This causes git_version_gen.sh to print to stdout.
2019-02-05 22:14:43 -08:00
ridiculousfish
c869ab541d Remove some additional xcode references 2019-02-05 22:14:43 -08:00
ridiculousfish
ecb808fb39 Teach make_pkg.sh to build fish.app via cmake 2019-02-05 22:14:43 -08:00
ridiculousfish
eaefed434d make_pkg.sh to build with CMake instead of Xcode 2019-02-05 22:14:43 -08:00
Fabian Homborg
eb8a93f499 lint.fish: Modernize a bit
Use argparse, variable-as-command, skip missingInclude.
2019-02-04 16:58:38 +01:00
David Adam
b60a9d8c4a pcre2: move to PCRE2 10.32
Closes #5353.
2018-12-29 22:54:40 +08:00
Mahmoud Al-Qudsi
a5b8359c1c Add script for diffing two fish profile runs
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?)
2018-10-14 16:45:16 -05:00
ridiculousfish
36a149337b Eliminate / vet and whitelist some more globals 2018-09-29 01:11:15 -04:00