Skip to content

Commit 66c222c

Browse files
authored
Merge pull request #1676 from EliahKagan/run-ci/journey-find
Let journey tests fail without `find` and enforce LF line endings
2 parents 881b601 + 05e176c commit 66c222c

File tree

4 files changed

+138
-160
lines changed

4 files changed

+138
-160
lines changed

.gitattributes

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
**/generated-archives/*.tar* filter=lfs-disabled diff=lfs merge=lfs -text
22

33
# assure line feeds don't interfere with our working copy hash
4-
**/tests/fixtures/**/*.sh text crlf=input eol=lf
5-
/justfile text crlf=input eol=lf
4+
*.sh text crlf=input eol=lf
5+
justfile text crlf=input eol=lf
66

77
# have GitHub include fixture-making scripts when it counts code
88
**/tests/fixtures/**/*.sh linguist-vendored=false

tests/journey/ein.sh

+121-123
Original file line numberDiff line numberDiff line change
@@ -28,144 +28,142 @@ title "Porcelain ${kind}"
2828
)
2929
)
3030
snapshot="$snapshot/porcelain"
31-
(with_program find
32-
(when "using the 'tool' subcommand"
33-
title "ein tool"
34-
(with "a repo with a tiny commit history"
35-
(small-repo-in-sandbox
36-
title "ein tool estimate-hours"
37-
(when "running 'estimate-hours'"
38-
snapshot="$snapshot/estimate-hours"
39-
(with "no arguments"
40-
it "succeeds and prints only a summary" && {
41-
WITH_SNAPSHOT="$snapshot/no-args-success" \
42-
expect_run_sh $SUCCESSFULLY "$exe tool estimate-hours 2>/dev/null"
43-
}
44-
)
45-
(with "the show-pii argument"
46-
it "succeeds and shows information identifying people before the summary" && {
47-
WITH_SNAPSHOT="$snapshot/show-pii-success" \
48-
expect_run_sh $SUCCESSFULLY "$exe tool estimate-hours --show-pii 2>/dev/null"
49-
}
50-
)
51-
(with "the omit-unify-identities argument"
52-
it "succeeds and doesn't show unified identities (in this case there is only one author anyway)" && {
53-
WITH_SNAPSHOT="$snapshot/no-unify-identities-success" \
54-
expect_run_sh $SUCCESSFULLY "$exe t estimate-hours --omit-unify-identities 2>/dev/null"
55-
}
56-
)
57-
(with "the --file-stats argument"
58-
it "succeeds and shows file statistics" && {
59-
WITH_SNAPSHOT="$snapshot/file-stats-success" \
60-
expect_run_sh $SUCCESSFULLY "$exe tool estimate-hours --file-stats 2>/dev/null"
61-
}
62-
)
63-
(with "the --line-stats argument"
64-
it "succeeds and shows line statistics" && {
65-
WITH_SNAPSHOT="$snapshot/line-stats-success" \
66-
expect_run_sh $SUCCESSFULLY "$exe tool estimate-hours --line-stats 2>/dev/null"
67-
}
68-
)
69-
(with "all --stats arguments and pii"
70-
it "succeeds and shows all statistics" && {
71-
WITH_SNAPSHOT="$snapshot/all-stats-success" \
72-
expect_run_sh $SUCCESSFULLY "$exe tool estimate-hours -pfl 2>/dev/null"
73-
}
74-
)
75-
(with "a branch name that doesn't exist"
76-
it "fails and shows a decent enough error message" && {
77-
WITH_SNAPSHOT="$snapshot/invalid-branch-name-failure" \
78-
expect_run_sh $WITH_FAILURE "$exe -q t estimate-hours . foobar"
79-
}
80-
)
31+
(when "using the 'tool' subcommand"
32+
title "ein tool"
33+
(with "a repo with a tiny commit history"
34+
(small-repo-in-sandbox
35+
title "ein tool estimate-hours"
36+
(when "running 'estimate-hours'"
37+
snapshot="$snapshot/estimate-hours"
38+
(with "no arguments"
39+
it "succeeds and prints only a summary" && {
40+
WITH_SNAPSHOT="$snapshot/no-args-success" \
41+
expect_run_sh $SUCCESSFULLY "$exe tool estimate-hours 2>/dev/null"
42+
}
43+
)
44+
(with "the show-pii argument"
45+
it "succeeds and shows information identifying people before the summary" && {
46+
WITH_SNAPSHOT="$snapshot/show-pii-success" \
47+
expect_run_sh $SUCCESSFULLY "$exe tool estimate-hours --show-pii 2>/dev/null"
48+
}
49+
)
50+
(with "the omit-unify-identities argument"
51+
it "succeeds and doesn't show unified identities (in this case there is only one author anyway)" && {
52+
WITH_SNAPSHOT="$snapshot/no-unify-identities-success" \
53+
expect_run_sh $SUCCESSFULLY "$exe t estimate-hours --omit-unify-identities 2>/dev/null"
54+
}
55+
)
56+
(with "the --file-stats argument"
57+
it "succeeds and shows file statistics" && {
58+
WITH_SNAPSHOT="$snapshot/file-stats-success" \
59+
expect_run_sh $SUCCESSFULLY "$exe tool estimate-hours --file-stats 2>/dev/null"
60+
}
61+
)
62+
(with "the --line-stats argument"
63+
it "succeeds and shows line statistics" && {
64+
WITH_SNAPSHOT="$snapshot/line-stats-success" \
65+
expect_run_sh $SUCCESSFULLY "$exe tool estimate-hours --line-stats 2>/dev/null"
66+
}
67+
)
68+
(with "all --stats arguments and pii"
69+
it "succeeds and shows all statistics" && {
70+
WITH_SNAPSHOT="$snapshot/all-stats-success" \
71+
expect_run_sh $SUCCESSFULLY "$exe tool estimate-hours -pfl 2>/dev/null"
72+
}
73+
)
74+
(with "a branch name that doesn't exist"
75+
it "fails and shows a decent enough error message" && {
76+
WITH_SNAPSHOT="$snapshot/invalid-branch-name-failure" \
77+
expect_run_sh $WITH_FAILURE "$exe -q t estimate-hours . foobar"
78+
}
8179
)
8280
)
8381
)
84-
(with "a mix of repositories"
85-
(sandbox
86-
repo-with-remotes dir/one-origin origin https://example.com/one-origin
87-
repo-with-remotes origin-and-fork origin https://example.com/origin-and-fork fork https://example.com/other/origin-and-fork
88-
repo-with-remotes special-origin special-name https://example.com/special-origin
89-
repo-with-remotes no-origin
90-
repo-with-remotes a-non-bare-repo-with-extension.git origin https://example.com/a-repo-with-extension.git
91-
snapshot="$snapshot/tool"
82+
)
83+
(with "a mix of repositories"
84+
(sandbox
85+
repo-with-remotes dir/one-origin origin https://example.com/one-origin
86+
repo-with-remotes origin-and-fork origin https://example.com/origin-and-fork fork https://example.com/other/origin-and-fork
87+
repo-with-remotes special-origin special-name https://example.com/special-origin
88+
repo-with-remotes no-origin
89+
repo-with-remotes a-non-bare-repo-with-extension.git origin https://example.com/a-repo-with-extension.git
90+
snapshot="$snapshot/tool"
9291

93-
title "ein tool find"
94-
(when "running 'find'"
95-
snapshot="$snapshot/find"
96-
(with "no arguments"
97-
it "succeeds and prints a list of repository work directories" && {
98-
WITH_SNAPSHOT="$snapshot/no-args-success" \
99-
expect_run_sh $SUCCESSFULLY "$exe tool find 2>/dev/null"
100-
}
101-
)
92+
title "ein tool find"
93+
(when "running 'find'"
94+
snapshot="$snapshot/find"
95+
(with "no arguments"
96+
it "succeeds and prints a list of repository work directories" && {
97+
WITH_SNAPSHOT="$snapshot/no-args-success" \
98+
expect_run_sh $SUCCESSFULLY "$exe tool find 2>/dev/null"
99+
}
102100
)
103-
title "ein tool organize"
104-
(when "running 'organize'"
105-
snapshot="$snapshot/organize"
106-
(with "no arguments"
107-
it "succeeds and informs about the operations that it WOULD do" && {
108-
WITH_SNAPSHOT="$snapshot/no-args-success" \
109-
expect_run_sh $SUCCESSFULLY "$exe tool organize 2>/dev/null"
110-
}
111-
112-
it "does not change the directory structure at all" && {
113-
WITH_SNAPSHOT="$snapshot/initial-directory-structure" \
114-
expect_run_sh $SUCCESSFULLY 'find . -maxdepth 2 | sort'
115-
}
116-
)
101+
)
102+
title "ein tool organize"
103+
(when "running 'organize'"
104+
snapshot="$snapshot/organize"
105+
(with "no arguments"
106+
it "succeeds and informs about the operations that it WOULD do" && {
107+
WITH_SNAPSHOT="$snapshot/no-args-success" \
108+
expect_run_sh $SUCCESSFULLY "$exe tool organize 2>/dev/null"
109+
}
117110

118-
(with "--execute"
119-
it "succeeds" && {
120-
WITH_SNAPSHOT="$snapshot/execute-success" \
121-
expect_run_sh $SUCCESSFULLY "$exe tool organize --execute 2>/dev/null"
122-
}
111+
it "does not change the directory structure at all" && {
112+
WITH_SNAPSHOT="$snapshot/initial-directory-structure" \
113+
expect_run_sh $SUCCESSFULLY 'find . -maxdepth 2 | sort'
114+
}
115+
)
123116

124-
it "changes the directory structure" && {
125-
WITH_SNAPSHOT="$snapshot/directory-structure-after-organize" \
126-
expect_run_sh $SUCCESSFULLY 'find . -maxdepth 2 | sort'
127-
}
128-
)
117+
(with "--execute"
118+
it "succeeds" && {
119+
WITH_SNAPSHOT="$snapshot/execute-success" \
120+
expect_run_sh $SUCCESSFULLY "$exe tool organize --execute 2>/dev/null"
121+
}
129122

130-
(with "--execute again"
131-
it "succeeds" && {
132-
WITH_SNAPSHOT="$snapshot/execute-success" \
133-
expect_run_sh $SUCCESSFULLY "$exe tool organize --execute 2>/dev/null"
134-
}
123+
it "changes the directory structure" && {
124+
WITH_SNAPSHOT="$snapshot/directory-structure-after-organize" \
125+
expect_run_sh $SUCCESSFULLY 'find . -maxdepth 2 | sort'
126+
}
127+
)
135128

136-
it "does not alter the directory structure as these are already in place" && {
137-
WITH_SNAPSHOT="$snapshot/directory-structure-after-organize" \
138-
expect_run_sh $SUCCESSFULLY 'find . -maxdepth 2 | sort'
139-
}
140-
)
129+
(with "--execute again"
130+
it "succeeds" && {
131+
WITH_SNAPSHOT="$snapshot/execute-success" \
132+
expect_run_sh $SUCCESSFULLY "$exe tool organize --execute 2>/dev/null"
133+
}
141134

142-
(with "--execute with move into subdirectory of itself"
143-
(cd example.com
144-
rm -Rf a-repo-with-extension origin-and-fork
145-
mv one-origin ../
146-
cd ..
147-
rmdir example.com && mv one-origin example.com
148-
)
149-
it "succeeds" && {
150-
WITH_SNAPSHOT="$snapshot/execute-success-new-root" \
151-
expect_run_sh $SUCCESSFULLY "$exe tool organize --execute 2>/dev/null"
152-
}
135+
it "does not alter the directory structure as these are already in place" && {
136+
WITH_SNAPSHOT="$snapshot/directory-structure-after-organize" \
137+
expect_run_sh $SUCCESSFULLY 'find . -maxdepth 2 | sort'
138+
}
139+
)
153140

154-
it "does alter the directory structure as these are already in place" && {
155-
WITH_SNAPSHOT="$snapshot/directory-structure-after-organize-to-new-root" \
156-
expect_run_sh $SUCCESSFULLY 'find . -maxdepth 2 -type d | sort'
157-
}
141+
(with "--execute with move into subdirectory of itself"
142+
(cd example.com
143+
rm -Rf a-repo-with-extension origin-and-fork
144+
mv one-origin ../
145+
cd ..
146+
rmdir example.com && mv one-origin example.com
158147
)
159-
)
160-
if test "$kind" != "max-pure"; then
161-
(with "running with no further arguments"
162-
it "succeeds and informs about possible operations" && {
163-
WITH_SNAPSHOT="$snapshot/no-args-failure" \
164-
expect_run_sh $WITH_CLAP_FAILURE "$exe t"
148+
it "succeeds" && {
149+
WITH_SNAPSHOT="$snapshot/execute-success-new-root" \
150+
expect_run_sh $SUCCESSFULLY "$exe tool organize --execute 2>/dev/null"
151+
}
152+
153+
it "does alter the directory structure as these are already in place" && {
154+
WITH_SNAPSHOT="$snapshot/directory-structure-after-organize-to-new-root" \
155+
expect_run_sh $SUCCESSFULLY 'find . -maxdepth 2 -type d | sort'
165156
}
166157
)
167-
fi
168158
)
159+
if test "$kind" != "max-pure"; then
160+
(with "running with no further arguments"
161+
it "succeeds and informs about possible operations" && {
162+
WITH_SNAPSHOT="$snapshot/no-args-failure" \
163+
expect_run_sh $WITH_CLAP_FAILURE "$exe t"
164+
}
165+
)
166+
fi
169167
)
170168
)
171169
)

tests/journey/gix.sh

+15-20
Original file line numberDiff line numberDiff line change
@@ -549,20 +549,17 @@ title "gix commit-graph"
549549
expect_run $WITH_FAILURE test -e "${PACK_FILE}".idx
550550
}
551551

552-
(with_program find
553-
554-
if test "$kind" = "small" ; then
555-
suffix=miniz-oxide
556-
elif test "$kind" = "max-pure"; then
557-
suffix=miniz-oxide-max
558-
else
559-
suffix=zlib-ng
560-
fi
561-
it "creates all pack objects, but the broken ones" && {
562-
WITH_SNAPSHOT="$snapshot/broken-with-objects-dir-skip-checks-success-tree-$suffix" \
563-
expect_run_sh $SUCCESSFULLY 'find . -type f | sort'
564-
}
565-
)
552+
if test "$kind" = "small" ; then
553+
suffix=miniz-oxide
554+
elif test "$kind" = "max-pure"; then
555+
suffix=miniz-oxide-max
556+
else
557+
suffix=zlib-ng
558+
fi
559+
it "creates all pack objects, but the broken ones" && {
560+
WITH_SNAPSHOT="$snapshot/broken-with-objects-dir-skip-checks-success-tree-$suffix" \
561+
expect_run_sh $SUCCESSFULLY 'find . -type f | sort'
562+
}
566563
)
567564
)
568565
)
@@ -582,12 +579,10 @@ title "gix commit-graph"
582579
"${PACK_FILE}.pack" .
583580
}
584581

585-
(with_program find
586-
it "creates all pack objects" && {
587-
WITH_SNAPSHOT="$snapshot/with-objects-dir-success-tree" \
588-
expect_run_sh $SUCCESSFULLY 'find . -type f | sort'
589-
}
590-
)
582+
it "creates all pack objects" && {
583+
WITH_SNAPSHOT="$snapshot/with-objects-dir-success-tree" \
584+
expect_run_sh $SUCCESSFULLY 'find . -type f | sort'
585+
}
591586
)
592587
)
593588
)

tests/utilities.sh

-15
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,6 @@ RED="$(tput setaf 1 2>/dev/null || echo -n '')"
77
OFFSET=( )
88
STEP=" "
99

10-
function with_program () {
11-
local program="${1:?}"
12-
hash "$program" &>/dev/null || {
13-
function expect_run () {
14-
echo 1>&2 "${WHITE} - skipped (missing program)"
15-
}
16-
function expect_run_sh () {
17-
echo 1>&2 "${WHITE} - skipped (missing program)"
18-
}
19-
function expect_run_sh_no_pipefail () {
20-
echo 1>&2 "${WHITE} - skipped (missing program)"
21-
}
22-
}
23-
}
24-
2510
function on_ci () {
2611
[ -n "${CI-}" ] || {
2712
function expect_run () {

0 commit comments

Comments
 (0)