Commit Graph

254 Commits

Author SHA1 Message Date
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
ridiculousfish
20cb62440c Eliminate some mutable global variables
Make them const or otherwise get rid of them
2018-09-29 00:20:50 -04:00
ridiculousfish
f465760d1f Add a tool to locate global variables 2018-09-29 00:18:33 -04:00
David Adam
1e0fab4fa4 git_version_gen: add support for out-of-tree tarballs
Closes #4122.
2018-08-28 23:10:24 +08:00
Mahmoud Al-Qudsi
f741968d6d Drop hard dependency on bash from git_version_gen.sh again
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.
2018-06-01 12:48:03 -05:00
Wilke Schwiedop
bd24e8662e fix 'sort | uniq' 2018-04-09 01:09:49 +02:00
Samuel Gagnon
dae0dd513d Fixes the FAQ questions in the sidebar of user_doc/html/index.html 2018-03-31 12:18:37 -07:00
ridiculousfish
df4b03d859 Fix CMake documentation build path
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.
2018-03-05 12:13:34 -08:00
Fabian Homborg
b75c3b968c Replace muparser with tinyexpr 2018-03-01 13:09:35 +01:00
David Adam
0a4883a6b8 Xcode build: use the same files as the CMake build for versioning
Closes #4671.
2018-01-19 22:31:08 +08:00
raichoo
069e4fdd8d do not depend on bash being installed in /bin (#4661) 2018-01-15 15:02:08 +01:00
ridiculousfish
faa17ec849 Correct a comment in git_version_gen.sh 2018-01-08 22:29:34 -08:00
ridiculousfish
d09210c08b [cmake] Untangle the CMake versioning
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..
2018-01-08 22:28:10 -08:00
ridiculousfish
da8db7f6f0 Revert "Generate FISH_BUILD_VERSION info for cmake builds"
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.
2018-01-08 22:28:10 -08:00
Mahmoud Al-Qudsi
25839b8c36 Generate FISH_BUILD_VERSION info for cmake builds
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
2017-12-30 17:38:09 -06:00
ridiculousfish
e2b798cda3 [muparser] Restyle muparser sources to match fish
Add muparser soruces to style.fish, and run it to make muparser
match fish style guidelines.
2017-12-18 11:58:13 -08:00
David Adam
834f344f1d build_documentation: postprocess regular expression uses command name
The previous regular expression only matched the `abbr` text and was
used in testing.
2017-12-15 09:53:15 +08:00
David Adam
69342066f4 build_documentation: reduce unnecessary copying, sed and perl
This saves about a second, which is not a lot, but dropping the build
dependency on perl is helpful.
2017-12-14 22:54:08 +08:00
David Adam
e98ecf9cfa build_lexicon_filter: drop which dependency 2017-11-30 15:00:52 +08:00
David Adam
b7fc3ee22e build_lexicon_filter: pass sed binary as command line argument
Ensures toolchain is consistent throughout; fixes documentation builds
on Homebrew.
2017-11-28 21:17:39 +08:00
David Adam
c8c129f7a5 build_lexicon_filter: remove erroneous variable brought across from Makefile 2017-11-28 21:16:26 +08:00
Michihito Shigemura
75cdaf5601 Support regex both BSD and GNU generating man pages 2017-11-26 18:19:45 -08:00
Michihito Shigemura
8e93041205 Stop outputting duplicate titles in man pages
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
2017-11-26 18:19:45 -08:00
Mahmoud Al-Qudsi
798ad363ba Fix extra ../ in figurig out GIT_DIR in build script 2017-10-25 16:43:39 -05:00
Mahmoud Al-Qudsi
e174b8a800 Fix build on platforms without bash
Build script build_tools/git_version_gen.sh had a hard dependency on
bash that was causing the build to fail on systems without bash.

Closes #4491
2017-10-25 15:57:36 -05:00
ridiculousfish
d08820f697 Update xcode_version_gen.sh for new build version file format
FISH-BUILD-VERSION-FILE no longer contains spaces. Update
xcode_version_gen.sh to know about that.

This fixes the Xcode build.
2017-10-18 11:51:18 -07:00
ridiculousfish
0909fe12e8 Additional work on building docs with CMake 2017-10-14 13:11:42 -07:00
ridiculousfish
861b55d7d8 Build FISH-BUILD-VERSION-FILE in CMake build
This adds support for creating the FISH-BUILD-VERSION-FILE in the CMake
build. A FISH-BUILD-VERSION-FILE is created in the CMake directory
and only updated when necessary.
2017-10-14 13:11:42 -07:00
ridiculousfish
d7baabab8d Factor out script to build user_doc
As part of factoring out the documentation building parts of the fish
build, add a new file build_user_doc.sh that builds the user_doc directory.
Invoke it from both the Makefile and CMake build.
2017-10-14 13:11:42 -07:00
ridiculousfish
dd9e057c6b Factor out script to build index.hdr
As part of factoring out the documentation building parts of the fish
build, add a new file build_index_hdr.sh that builds the index.hdr
file. Invoke it from both the Makefile and CMake build.
2017-10-14 13:11:42 -07:00
ridiculousfish
baba19c180 Factor out script to build index.hdr
As part of factoring out the documentation building parts of the fish
build, add a new file build_index_hdr.sh that builds the index.hdr
file. Invoke it from both the Makefile and CMake build.
2017-10-14 13:11:42 -07:00
ridiculousfish
088450cbf5 Factor out script to build commands.hdr
As part of factoring out the documentation building parts of the fish
build, add a new file build_commands_hdr.sh that builds the commands.hdr
file. Invoke it from both the Makefile and CMake build.
2017-10-14 13:11:42 -07:00
ridiculousfish
f044084f3a Factor out building lexicon_filter into separate script
This adds a new script build_tools/build_lexicon_filter.sh
that builds the lexicon filter. It is factored out from the Makefile,
and both the Makefile and CMake build invoke it.
2017-10-14 13:11:41 -07:00
Aaron Gyes
8b9e5c9301 Remove iwyu.sh
One should use lint.fish.
2017-10-09 22:33:28 -07:00
Kurtis Rader
4284e58033 Exclude muparser from oclint (#4397) 2017-09-11 10:50:38 -07:00
Kurtis Rader
ee226eeccd Fix incorrect recommendations by IWYU on macOS 2017-09-09 00:18:05 -07:00
David Adam
dcb39bfa86 Revert "Enable support for custom versioning"
This reverts functional changes in commit
3bef4a3c1f.

 * Annotated tags only should be used for releases - see #3572 for
   examples of where we want to use lightweight tags.

   See also git-tag(1) on the purpose of annotated and lightweight tags.

 * Version numbers are numbers and should not start with a branch name.

   The commit ID is embedded in the version and uniquely identifies the
   history. `fish --version` and `echo $FISH_VERSION` contain this
   information.
2017-08-16 20:54:39 +08:00
Kurtis Rader
3bef4a3c1f Enable support for custom versioning
Now that we're working on the 3.0.0 major release it is more important
than ever that fish binaries built by developers have version strings
which clearly communicate where they came from.
2017-08-15 12:43:11 -07:00
Kurtis Rader
3e29793d04 improve detection of msgs to be translated
This change does several things. First, it works around a quirk of the
`xgetttext` command that only recognizes description strings in even
numbered position on the command. Second, it allows descriptions
introduced by the `-d` short flag to be recognized.

More importantly, it normalizes the strings so that `xgettext` correctly
extracts them into the *.po file. Prior to this change many fish script
strings were ignored due to how they were written (e.g., single versus
double quotes).

Fixes #4073
2017-06-02 17:52:55 -07:00
David Adam
846de82bb4 build_tools: drop completions generators
The generators for various version control systems have not been run for
some time and will overwrite the updated completions already in the the
tree.
2017-05-16 20:22:06 +08:00
Kurtis Rader
6d02bec4c7 fix setting up and using the terminfo data
There should be just one place that calls `setupterm()`. While refactoring
the code I also decided to not make initializing the curses subsystem a
fatal error. We now try two fallback terminal names ("ansi" and "dumb")
and if those can't be used we still end up with a usable shell.

Fixes #3850
2017-03-08 20:54:37 -08:00
Kurtis Rader
7d65141137 be quiet when make style does nothing
The `make style` and `make style-all` commands have been performing well
without glitches for long enough that it is no longer necessary to report
when they don't change the style of a file. Especially in light of the
fact that all the relevant code has been restyled in the past year. This
change makes `make style-all` much less noisy.
2017-02-22 20:57:15 -08:00
Kurtis Rader
69731f6642 more IWYU fixes
I'm starting to wonder if IWYU is worth the effort. Nonetheless, this
makes it lint clean on macOS and reduces the number of warnings on
FreeBSD and Linux.
2017-02-12 20:36:37 -08:00
Kurtis Rader
ce2d1c4e83 fix IWYU on FreeBSD 2017-02-12 20:36:37 -08:00
Kurtis Rader
9cae25d1eb correct test for IWYU command
I noticed this when testing what `make lint-all` would output on FreeBSD
12 which does not have a symlink from `iwyu` to `include-what-you-use`.
2017-02-11 21:30:38 -08:00
Kurtis Rader
4ffb0adb78 lint cleanups 2017-02-11 21:30:38 -08:00
David Adam
8339e28cfe build_tools/list_committers_since.fish: tool for showing new & returning committers 2017-02-04 21:04:03 +08:00
Kurtis Rader
949fc7bdd7 fix IWYU lint
Commit 8645aa94 was made because it seemed necessary at the time.  However,
when I run `make lint-all` now it complains about include loops for header
`signal.h`. This reverts part of that earlier commit to get sane behavior
from IWYU again.
2017-02-01 22:06:24 -08:00
mathbunnyru
9768653df7 New pcre2 2017-01-18 16:44:48 -08:00
mathbunnyru
7a80610300 Delete trailing spaces 2017-01-15 14:57:21 -08:00