Commit Graph

78 Commits

Author SHA1 Message Date
Benjamin Sago
93bd052c70 Make Vagrant provisioning quieter and faster
• Install fewer Rust components
• Silence the output of some commands
• Only locale-gen the locales we need, and only do it once

While the 'vagrant up' and 'vagrant provision' times are still very long, and these benchmarks are very variable, there's a noticeable improvement here:

• 'vagrant up' has gone from ~244s to ~223s
• 'vagrant provision' has gone from ~21s to ~7s
2020-10-18 01:19:43 +01:00
Benjamin Sago
61c5df7c11 Use Specsheet for the extended tests
This commit changes the way the extended test suite is run.

Previously, there was a folder full of outputs, and a script that ran exa repeatedly to check the outputs match. This script was hacked-together, with many problems:

• It stops at the first failure, so if one test fails, you have no idea how many actually failed.
• It also didn't actually show you the diff if one was different, it just checked it.
• It combined stdout and stderr, and didn't test the exit status of exa.
• All the output file names were just whatever I felt like calling the file at the time.
• There is no way to only run a few of the tests — you have to run the whole thing each time.
• There's no feel-good overall view where you see how many tests are passing.

I started writing Specsheet to solve this problem (amongst other problems), and now, three and a half years later, it's finally ready for prime time.

The tests are now defined as data rather than as a script. The outputs have a consistent naming convention (directory_flags.ansitxt), and they check stdout, stderr, and exit status separately. Specsheet also lets simple outputs (empty, non-empty, or one-line error messages) can be written inline rather than needing to be in files.

So even though this pretty much runs the same tests as the run.sh script did, the tests are now more organised, making it easy to see where tests are missing and functionality is not being tested.
2020-10-17 21:12:18 +01:00
Benjamin Sago
91f1541e85 Make the Vagrant environment creation nicer
Now, instead of reams of unreadable command output, we get a nice set of stages:

[ 0/13] Deleting existing test cases directory
[ 1/13] Creating file size testcases
[ 2/13] Creating file name extension testcases
[ 3/13] Creating file names testcases
[ 4/13] Creating special file kind testcases
[ 5/13] Creating symlink testcases
[ 6/13] Creating user and group testcases
[ 7/13] Creating file permission testcases
[ 8/13] Creating date and time testcases
[ 9/13] Creating extended attribute testcases
[10/13] Creating Git testcases (1/3)
[11/13] Creating Git testcases (2/3)
[12/13] Creating Git testcases (3/3)
[13/13] Creating hidden and dot file testcases

The scripts have been moved out of the Vagrantfile because it was getting long and they're more readable this way.
2020-10-16 23:41:25 +01:00
Benjamin Sago
5ca3548bb1 Inline the library into the binary
This commit removes the library portion of exa. Cargo now only builds a binary.

The original intent was for exa to have its own internal library, and have the binary just call the library. This is usually done for code cleanliness reasons: it separates the code that implements the purpose of the program (the "plumbing") from the code that the user interacts with (the "porcelain"), ensuring a well-defined interface between the two.

However, in exa, this split was in completely the wrong place. Logging was handled in the binary, but option parsing was handled in the library. The library could theoretically print to any Writer ("for testing", it said), but it's far easier to run integration tests by executing the binary than to change the code to handle unit tests, so this abstraction isn't gaining us anything.

I've also had several people ask me if exa should be packaged for Linux distributions as a library, or just a binary. Clearly, this is confusing!

In several of my other Rust projects, I've done this better, with the command-line option parsing and log printing done on the binary side. It also turns out that you don't need to have a [lib] section in the Cargo.toml, so that's gone too.
2020-10-10 01:43:42 +01:00
Benjamin Sago
ee898bef8d Add commands to test feature combinations
Using the cargo-hack command, which now gets installed in the Vagrant environment, there's now an easy way to make sure exa can be built and test with all combinations of features.

There have been times in the past where exa has failed to build without the git feature, and I've just never noticed. This should put a stop to that.
2020-10-10 00:57:20 +01:00
Benjamin Sago
0550faec05 Replace Makefile with a developmental Justfile
This commit deletes the Makefile, which contained targets to build exa and install it on the local machine, and replaces it with a Justfile, which only contains command to build and test exa.

My reasoning for doing this is as follows:

• exa is increasingly being installed through package managers, rather than built and tested locally, so users are avoiding using the Makefile at all.
• It was a pain to keep up with the correct paths for installing the binary, man pages, and completions, which can vary between OSes. By removing them, the code in this repository need only concern itself with building exa and putting its files in the 'target' directory, simplifying things.
• just is much simpler than make conceptually, which is why I prefer it. It just runs commands, rather than being a complete build system, which we already use Cargo for.
• just has features built-in, such as listing tasks, that we've had to create make targets for.
• exa only needed a Makefile at all because it pre-dates Cargo!
• Other Rust projects seem to be getting along perfectly fine without one.

If I've missed some important reason that makes it worth keeping the Makefile around then please let me know.
2020-10-10 00:57:04 +01:00
Benjamin Sago
e95eb5e9fc Vagrant changes
• Get rid of the 'fresh' VM. It just got in the way, taking up more memory when 'vagrant up' was used, and only solved one problem  that was happening three years ago when I was at RustFest and in a programm-y mood.
• Use a more up-to-date Ubuntu image and give the machine more cores.
• Start moving some of the developer tools out of this repo. As I get more and more Rust projects, I don't want the scripts to package them to be repeated in each repository.
2020-10-10 00:21:20 +01:00
Benjamin Sago
64bd1b9a55
Merge pull request #584 from msehnout/fix-panic-on-broken-symlink
fix panic on broken symlink in git repository
2020-01-19 00:48:07 +00:00
Benjamin Sago
565a323661 Vagrantfile changes
• Use a newer Ubuntu box that works with vmware
• Give it a bit more resources
2020-01-19 00:37:24 +00:00
Martin Sehnoutka
a7a8e99cf3 fix panic on broken symlink in git repository
The issue including reproducer is described here:
https://github.com/ogham/exa/issues/526
This commit includes proposed change as well as integration test.
2019-09-15 16:56:58 +02:00
Benjamin Sago
19a2eb168a git2-rs v0.9.1
Most importantly, binaries produced from this version don’t link to http-parser (or at least they didn’t when I tried it), so the Vagrantfile doesn’t need to configure the custom version of it.
2019-07-14 11:42:58 +01:00
Benjamin Sago
7dada93c3e Refresh extended tests
It’s clear that these hadn’t actually been run for a while, and after installing Vagrant again I had to clear out the cobwebs. Necessary changes include:

• Rust is installed differently
• Git-ignored files are now marked
• The help text changed
• Listing a directory symlink shows its contents, requiring a change to the way a directory-symlink test gets run
2019-07-13 20:15:44 +01:00
Benjamin Sago
70606f95ff Change user in Vagrantfile
Why I have to keep doing this I have no idea. If you know, please tell!
2018-09-26 21:25:50 +01:00
Benjamin Sago
2e2598c9a0 Rename the zips for weekly releases 2017-10-08 20:53:36 +01:00
Benjamin Sago
431998d0f6 Spiffy up the help text 2017-10-02 10:32:25 +02:00
Benjamin Sago
895808e945 Show friendlier warnings when binaries don’t exist
Also, allow the --release flags to be passed to the build-exa and test-exa commands.
2017-10-02 10:22:50 +02:00
Benjamin Sago
eb1188c2c8 Give the testing VM commands and help text 2017-10-01 12:37:35 +02:00
Benjamin Sago
a739299583 Add a release-checking script 2017-10-01 12:28:23 +02:00
Benjamin Sago
a4bd8f7f17 Move the welcoming text to their own files too
Again, it was hard to read and edit this text when it was in a string inside an echo command inside a bash script inside a heredoc inside a Ruby script wrapped in a mystery. It also gives me space to write some actual comments.
2017-10-01 09:49:45 +02:00
Benjamin Sago
173e9b2345 Move the packaging script into its own file
Having it all echo-ed into the file like that made it hard to read *and* hard to maintain. My initial aversion to it was that I didn’t want there to be an executable script in the main repository that only worked when you were in the VM, because people would just run it anyway. But this can be avoided by leaving it non-executable, and having a command in the VM that runs it instead.
2017-10-01 09:48:20 +02:00
Benjamin Sago
02403c7cc5 Also include a ‘fresh’ VM for staticness testing
This fresh VM deliberately contains no dependencies and installs nothing, so it can be used to check that the uploaded binary still runs.
2017-09-30 15:23:55 +02:00
Benjamin Sago
29bb3645f4 Don’t include the path in the zipped binary
The ‘package-exa’ script’s zip contained /vagrant/exa-linux-x86_64 instead of just exa-linux-x86_64, and I never noticed.

https://stackoverflow.com/a/9710181/3484614 told me what to do.
2017-09-30 15:20:20 +02:00
Benjamin Sago
2b099d8ba0 Fix up tests to have nested ignored files 2017-09-30 09:17:28 +02:00
Benjamin Sago
7339b753fb vagrant: Update apt before installing
I updated my Vagrant box and destroyed and rebuilt it, and for some reason, it didn’t know about ‘fish’. Updating beforehand fixes it.
2017-09-30 09:17:28 +02:00
Benjamin Sago
cfc05eef00 Add test for nested Git repository
I don’t know how this should work, but let’s at least record the current behaviour in case it changes
2017-08-28 18:24:20 +01:00
Benjamin Sago
55aaecb74d Improve Git test coverage
- Two different repositories being queried at once
- The same one being queried twice, at different depths
- Tests for --tree and --recurse that should break in the future when that’s implemented
- Also just more tests in general
2017-08-28 15:10:29 +01:00
Benjamin Sago
b13b37ed29 Add exa_colors support to the Vagrant VM 2017-08-26 23:44:29 +01:00
Benjamin Sago
4cab5b6b94 Don’t re-clone the git2-rs repo
Apparently trying to clone a repository onto an already-cloned clone just errors
2017-08-26 15:13:19 +01:00
Benjamin Sago
44cee6b60c Add unnecessary hacker theme 2017-08-26 14:05:08 +01:00
Benjamin Sago
3405db1f4b Use my patched verson of git2-rs
Now, the Vagrant VM uses my patched version of git2-rs, which has a modified build.rs file in libgit2-sys, which blocks libhttp_parser from being linked. As you can see by the comment, I’m not a fan of the fix, but at least it works, right?

See #194, and also #255.
2017-08-20 20:04:59 +01:00
Benjamin Sago
414b347ae5 Formalise exa-packaging script
Every time I had to build exa, I copied the files manually and checked to make sure they all had the same name. There’s now a script that does all that stuff for me, so I don’t need to remember to do it anymore.

It also does some things that weren’t being done before, including stripping the binary and listing its linked dependencies to we can tell if something like libhttp_parser has slipped in there (see #194)
2017-08-20 18:22:08 +01:00
Benjamin Sago
d716bb72c9 Say where the target directory is too 2017-08-19 23:36:25 +01:00
Benjamin Sago
69fbf8b6c0 Quieten the test output 2017-08-19 23:25:51 +01:00
Benjamin Sago
d980f3ef85 Make the prompt bold 2017-08-19 22:37:52 +01:00
Benjamin Sago
c2779403a7 And again for LS_COLORS 2017-08-19 21:58:59 +01:00
Benjamin Sago
b2cbb909e1 Do the same for strict mode 2017-08-19 21:20:14 +01:00
Benjamin Sago
886398eda9 Make debug mode switch-on-and-offable 2017-08-19 21:13:44 +01:00
Benjamin Sago
6eb3face43 Include a fancy custom prompt 2017-08-19 20:23:37 +01:00
Benjamin Sago
1c2e34f649 Add some more helper scripts
Also, add some welcoming text when the user logs in over SSH.
2017-08-19 19:47:39 +01:00
Benjamin Sago
9e4ac8cae9 Add global aliases for cargo and xtests 2017-08-19 16:03:08 +01:00
Christopher Vittal
1bce51c9c8 Add extra types to compressed filetype filter.
This adds a few more common compressed filetypes to the is_compressed
fuction. Notably, xz, and two common package file formats, deb and rpm.
2017-08-07 00:57:29 -04:00
Benjamin Sago
115315a03c Test the locale month name width stuff
This commit modifies a specific file timestamp so we test both July (which is 5 characters in French) and December (which is 4 characters in Japanese). It’s also kind of a test for locales as well.
2017-08-06 22:25:00 +01:00
Benjamin Sago
2d1f462bfa Switch to the new options parser
This commit removes the dependency on the ‘getopts’ crate entirely, and re-writes all its uses to use the new options parser instead.

As expected there are casualties galore:

- We now need to collect the options into a vector at the start, so we can use references to them, knowing they’ll be stored *somewhere*.
- Because OsString isn’t Display, its Debug impl gets used instead. (This is hopefully temporary)
- Options that take values (such as ‘sort’ or ‘time-style’) now parse those values with ‘to_string_lossy’. The ‘lossy’ part means “I’m at a loss for what to do here”
- Error messages got a lot worse, but “--tree --all --all” is now a special case of error rather than just another Misfire::Useless.
- Some tests had to be re-written to deal with the fact that the parser works with references.
- ParseError loses its lifetime and owns its contents, to avoid having to attach <'a> to Misfire.
- The parser now takes an iterator instead of a slice.
- OsStrings can’t be ‘match’ patterns, so the code devolves to using long Eq chains instead.
- Make a change to the xtest that assumed an input argument with invalid UTF-8 in was always an error to stderr, when that now in fact works!
- Fix a bug in Vagrant where ‘exa’ and ‘rexa’ didn’t properly escape filenames with spaces in.
2017-07-26 17:48:18 +01:00
Benjamin Sago
5bdf6304bb Fix bug where accessed times were wrong!
It used the mtime, rather than the atime. Copy and paste error. Whoops!
2017-07-05 22:07:03 +01:00
Benjamin Sago
882ac489ce Much more thorough xattr testing
It now tests a lot more combinations of xattrs on files, as well as xattrs and files and errors as the children of directories.

The recent code changes have touched the part where directories’ xattrs and children are displayed at the same tree level, and there weren’t enough tests for this.
2017-07-04 17:42:16 +01:00
Benjamin Sago
5a2ffd3fbe Generate files with certain timestamps
This is going to be used to test time formatting.

Casualty here is that the “have you not ran the provisioning script in a year?” checker complained about there being files more than a year old, so that now has to ignore the times directory.
2017-07-03 08:46:38 +01:00
Benjamin Sago
9d74091195 Upcase some of the extension testcases
These are going to be used for sort testing. Unfortunately, three existing tests that were using the lowercase versions had to be changed.
2017-06-29 13:57:31 +01:00
Benjamin Sago
dd8bff083f Override the names of . and ..
There was a problem when displaying . and .. in directory listings: their names would normalise to actual names! So instead of literally seeing `.`, you’d see the current directory’s name, inserted in sort order into the list of results. Obviously this is not what we want.

In unrelated news, putting `.` and `..` into the list of paths read from a directory just takes up more heap space for something that’s basically constant.

We can solve both these problems at once by moving the DotFilter to the files iterator in Dir, rather than at the Dir’s creation. Having the iterator know whether it should display `.` and `..` means it can emit those files first, and because it knows what those files really represent, it can override their file names to actually be those sequences of dots.

This is not a perfect solution: the main casualty is that a File can now be constructed with a name, some metadata, both, or neither. This is currently handled with a bunch of Options, and returns IOResult even without doing any IO operations.

But at least all the tests pass!
2017-06-28 18:41:31 +01:00
Benjamin Sago
c4447e35b6 xtests for higher order bits
Finally, re-do the permissions extended tests to include the setuid, setgid, and sticky bits, and rename the last two existing ones to match the others (files with the same names as their permissions).
2017-05-30 15:32:11 +01:00
Benjamin Sago
e10c4b3eb9 Add xtests for existing Git implementation 2017-05-17 20:35:05 +01:00