Skip to content

Commit f672892

Browse files
committed
Introduce "local" tag to work around github's non-POSIX file system
1 parent d1f006e commit f672892

4 files changed

Lines changed: 41 additions & 30 deletions

File tree

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CMDDEPENDS=$(GENERATED) *.go Makefile $(MANPAGE)
1111
all: $(CMD)
1212

1313
$(CMD): $(CMDDEPENDS)
14-
go build
14+
go build -tags local
1515

1616
version.go: generate_version.sh ChangeLog.md go.mod Makefile
1717
sh generate_version.sh ChangeLog.md version.go
@@ -27,16 +27,20 @@ clean:
2727

2828
.PHONY: vet
2929
vet: $(GENERATED)
30-
go vet ./...
30+
go vet -tags local ./...
3131
mandoc -Tlint $(MANPAGE); exit 0
3232

3333
.PHONY: install
3434
install: $(BINDIST)/$(CMD) $(MANDIST)/$(MANPAGE)
3535

3636
.PHONY: test tests
3737

38+
# The "local" tag is my convention for any build or test requirements which can only be
39+
# satisified on a local system with a regular local file system. This is largely used to
40+
# turn off some tests which fail on github because it presents a funky file system which
41+
# is not POSIX.
3842
test tests: $(GENERATED)
39-
go test -race -v
43+
go test -tags local -race -v
4044

4145
$(BINDIST)/$(CMD): $(CMD) Makefile
4246
install -d -m u=rwx,go=rx $(BINDIST) # Ensure destination exists
@@ -54,5 +58,5 @@ $(MANDIST)/$(MANPAGE): $(MANPAGE) Makefile
5458
windows: fad.exe
5559
fad.exe: $(CMDDEPENDS)
5660
@echo 'Building for Windows amd64 (10 or higher)'
57-
@GOOS=windows GOARCH=amd64 go build
61+
@GOOS=windows GOARCH=amd64 go build -tags local
5862
@file $(CMD).exe

scanner_local_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//go:build local
2+
3+
package main
4+
5+
import (
6+
"bytes"
7+
"flag"
8+
"testing"
9+
)
10+
11+
// Check basic scaner functionality. That scan returns a single entry which is also the
12+
// one with the most recent DTM. Unfortunately this test fails on github for reasons to do
13+
// with their funky file-system so it's only run on a non-gitgub environment.
14+
func TestScannerBasic(t *testing.T) {
15+
var stderr bytes.Buffer
16+
cfg := newConfig(flag.NewFlagSet(Name, flag.ContinueOnError),
17+
func() (string, error) { return "", nil })
18+
scn, can, err := testScannerSetup(cfg, &stderr, 10)
19+
if err != nil {
20+
t.Fatal(err)
21+
}
22+
23+
scn.descend(0, "testdata/scan10")
24+
scn.wait()
25+
26+
if len(can.cf) != 1 {
27+
t.Fatal("Expected 1 entry from testdata/scan10, got", len(can.cf))
28+
}
29+
if can.cf[0].path != "testdata/scan10/README" {
30+
t.Error("Expected scan to return README, not", can.cf[0].path)
31+
}
32+
}

scanner_test.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -81,31 +81,6 @@ func TestStats(t *testing.T) {
8181
}
8282
}
8383

84-
/*
85-
// Check that scan returns a single entry which is also the one with the most recent DTM. Unfortunately
86-
// this test fails on github for reasons to do with their funky file-system so we've commented this
87-
// out for now.
88-
func TestScannerStart(t *testing.T) {
89-
var stderr bytes.Buffer
90-
cfg := newConfig(flag.NewFlagSet(Name, flag.ContinueOnError),
91-
func() (string, error) { return "", nil })
92-
scn, can, err := testScannerSetup(cfg, &stderr, 10)
93-
if err != nil {
94-
t.Fatal(err)
95-
}
96-
97-
scn.descend(0, "testdata/scan10")
98-
scn.wait()
99-
100-
if len(can.cf) != 1 {
101-
t.Fatal("Expected 1 entry from testdata/scan10, got", len(can.cf))
102-
}
103-
if can.cf[0].path != "testdata/scan10/README" {
104-
t.Error("Expected scan to return README, not", can.cf[0].path)
105-
}
106-
}
107-
*/
108-
10984
// Test for readDir error return
11085
func TestScannerReaddir(t *testing.T) {
11186
var stderr bytes.Buffer

version.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)