2016-10-07 18:31:03 +00:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
set +xe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# The exa binary we want to run
|
|
|
|
|
exa="$HOME/target/debug/exa --colour=always"
|
|
|
|
|
|
|
|
|
|
# Directory containing our awkward testcase files
|
2017-04-28 18:34:23 +00:00
|
|
|
|
testcases=/testcases
|
2016-10-07 18:31:03 +00:00
|
|
|
|
|
|
|
|
|
# Directory containing existing test results to compare against
|
|
|
|
|
results=/vagrant/xtests
|
|
|
|
|
|
|
|
|
|
|
2017-04-28 18:26:57 +00:00
|
|
|
|
# Check that no files were created more than a year ago.
|
|
|
|
|
# Files not from the current year use a different date format, meaning
|
|
|
|
|
# that tests will fail until the VM gets re-provisioned.
|
|
|
|
|
sudo find $testcases -mtime +365 -printf "File %p has not been modified since %TY! Consider re-provisioning; tests will probably fail.\n"
|
|
|
|
|
|
2017-04-28 18:34:23 +00:00
|
|
|
|
|
2016-10-07 18:31:03 +00:00
|
|
|
|
# Long view tests
|
2017-04-29 10:03:43 +00:00
|
|
|
|
$exa $testcases/files -l | diff -q - $results/files_l || exit 1
|
2016-10-07 18:31:03 +00:00
|
|
|
|
$exa $testcases/files -lh | diff -q - $results/files_lh || exit 1
|
|
|
|
|
$exa $testcases/files -lhb | diff -q - $results/files_lhb || exit 1
|
|
|
|
|
$exa $testcases/files -lhB | diff -q - $results/files_lhb2 || exit 1
|
2016-10-29 18:07:43 +00:00
|
|
|
|
$exa $testcases/attributes/dirs/empty-with-attribute -lh | diff -q - $results/empty || exit 1
|
|
|
|
|
|
2017-04-28 18:34:23 +00:00
|
|
|
|
|
2016-10-07 18:31:03 +00:00
|
|
|
|
# Grid view tests
|
|
|
|
|
COLUMNS=40 $exa $testcases/files | diff -q - $results/files_40 || exit 1
|
|
|
|
|
COLUMNS=80 $exa $testcases/files | diff -q - $results/files_80 || exit 1
|
|
|
|
|
COLUMNS=120 $exa $testcases/files | diff -q - $results/files_120 || exit 1
|
|
|
|
|
COLUMNS=160 $exa $testcases/files | diff -q - $results/files_160 || exit 1
|
|
|
|
|
COLUMNS=200 $exa $testcases/files | diff -q - $results/files_200 || exit 1
|
|
|
|
|
|
2017-05-02 16:40:32 +00:00
|
|
|
|
COLUMNS=100 $exa $testcases/files/* | diff -q - $results/files_star_100 || exit 1
|
|
|
|
|
COLUMNS=150 $exa $testcases/files/* | diff -q - $results/files_star_150 || exit 1
|
|
|
|
|
COLUMNS=200 $exa $testcases/files/* | diff -q - $results/files_star_200 || exit 1
|
|
|
|
|
|
2017-04-28 18:34:23 +00:00
|
|
|
|
|
2016-10-07 18:31:03 +00:00
|
|
|
|
# Long grid view tests
|
|
|
|
|
COLUMNS=40 $exa $testcases/files -lG | diff -q - $results/files_lG_40 || exit 1
|
|
|
|
|
COLUMNS=80 $exa $testcases/files -lG | diff -q - $results/files_lG_80 || exit 1
|
|
|
|
|
COLUMNS=120 $exa $testcases/files -lG | diff -q - $results/files_lG_120 || exit 1
|
|
|
|
|
COLUMNS=160 $exa $testcases/files -lG | diff -q - $results/files_lG_160 || exit 1
|
|
|
|
|
COLUMNS=200 $exa $testcases/files -lG | diff -q - $results/files_lG_200 || exit 1
|
|
|
|
|
|
2017-05-02 16:40:32 +00:00
|
|
|
|
COLUMNS=100 $exa $testcases/files/* -lG | diff -q - $results/files_star_lG_100 || exit 1
|
|
|
|
|
COLUMNS=150 $exa $testcases/files/* -lG | diff -q - $results/files_star_lG_150 || exit 1
|
|
|
|
|
COLUMNS=200 $exa $testcases/files/* -lG | diff -q - $results/files_star_lG_200 || exit 1
|
|
|
|
|
|
2017-04-28 18:34:23 +00:00
|
|
|
|
|
2016-10-07 18:31:03 +00:00
|
|
|
|
# Attributes
|
|
|
|
|
$exa $testcases/attributes -l@T | diff -q - $results/attributes || exit 1
|
|
|
|
|
|
2017-04-28 18:34:23 +00:00
|
|
|
|
|
2016-10-07 18:31:03 +00:00
|
|
|
|
# UIDs and GIDs
|
|
|
|
|
$exa $testcases/passwd -lgh | diff -q - $results/passwd || exit 1
|
|
|
|
|
|
2017-04-28 18:34:23 +00:00
|
|
|
|
|
|
|
|
|
# Permissions, and current users and groups
|
|
|
|
|
sudo -u cassowary $exa $testcases/permissions -lghR 2>&1 | diff -q - $results/permissions_sudo || exit 1
|
|
|
|
|
$exa $testcases/permissions -lghR 2>&1 | diff -q - $results/permissions || exit 1
|
|
|
|
|
|
2017-05-01 14:06:37 +00:00
|
|
|
|
# File names
|
2017-05-01 20:54:53 +00:00
|
|
|
|
# (Mostly escaping control characters in file names)
|
2017-05-01 14:06:37 +00:00
|
|
|
|
COLUMNS=80 $exa $testcases/file-names 2>&1 | diff -q - $results/file_names || exit 1
|
|
|
|
|
COLUMNS=80 $exa $testcases/file-names -x 2>&1 | diff -q - $results/file_names_x || exit 1
|
2017-05-01 20:54:53 +00:00
|
|
|
|
COLUMNS=80 $exa $testcases/file-names -R 2>&1 | diff -q - $results/file_names_R || exit 1
|
2017-05-01 14:06:37 +00:00
|
|
|
|
$exa $testcases/file-names -1 2>&1 | diff -q - $results/file_names_1 || exit 1
|
2017-05-01 20:54:53 +00:00
|
|
|
|
$exa $testcases/file-names -T 2>&1 | diff -q - $results/file_names_T || exit 1
|
2016-10-07 18:31:03 +00:00
|
|
|
|
|
2016-10-29 18:25:07 +00:00
|
|
|
|
# File types
|
2017-04-28 19:07:31 +00:00
|
|
|
|
$exa $testcases/file-names-exts -1 2>&1 | diff -q - $results/file-names-exts || exit 1
|
2017-04-29 08:21:31 +00:00
|
|
|
|
$exa $testcases/specials -l 2>&1 | diff -q - $results/specials || exit 1
|
|
|
|
|
$exa $testcases/specials -F -l 2>&1 | diff -q - $results/specials_F || exit 1
|
2016-10-29 18:25:07 +00:00
|
|
|
|
|
2017-04-28 18:34:23 +00:00
|
|
|
|
|
2016-10-30 14:43:33 +00:00
|
|
|
|
# Ignores
|
2017-04-28 19:07:31 +00:00
|
|
|
|
$exa $testcases/file-names-exts/music.* -I "*.ogg" -1 2>&1 | diff -q - $results/ignores_ogg || exit 1
|
|
|
|
|
$exa $testcases/file-names-exts/music.* -I "*.ogg|*.mp3" -1 2>&1 | diff -q - $results/empty || exit 1
|
2016-10-30 14:43:33 +00:00
|
|
|
|
|
2016-10-29 18:58:34 +00:00
|
|
|
|
|
2017-04-29 09:56:17 +00:00
|
|
|
|
# Paths and directories
|
|
|
|
|
# These directories are created in the VM user’s home directory (the default
|
|
|
|
|
# location) when a Cargo build is done.
|
|
|
|
|
(cd; $exa -1d target target/debug target/debug/build | diff -q - $results/dir_paths) || exit 1
|
2017-04-29 10:52:44 +00:00
|
|
|
|
$exa -1d . .. / | diff -q - $results/dirs || exit 1
|
2017-04-29 09:56:17 +00:00
|
|
|
|
|
|
|
|
|
|
2017-04-28 18:34:23 +00:00
|
|
|
|
# Links
|
|
|
|
|
COLUMNS=80 $exa $testcases/links 2>&1 | diff -q - $results/links || exit 1
|
|
|
|
|
$exa $testcases/links -1 2>&1 | diff -q - $results/links_1 || exit 1
|
|
|
|
|
$exa $testcases/links -T 2>&1 | diff -q - $results/links_T || exit 1
|
|
|
|
|
$exa /proc/1/root -T 2>&1 | diff -q - $results/proc_1_root || exit 1
|
2016-10-29 19:27:23 +00:00
|
|
|
|
|
2016-10-07 18:31:03 +00:00
|
|
|
|
|
|
|
|
|
echo "All the tests passed!"
|