mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 08:23:48 +03:00
aad5a5bcb9
the backup command will make consistent snapshots of all the database files. i had been copying the db files before, and it usually works. but if the file is modified during the backup, it is inconsistent and is likely to generate errors when reading (can be at any moment in the future, when reading some db page). "mox backup" opens the database file and writes out a copy in a transaction. it also duplicates the message files. before doing a restore, you could run "mox verifydata" on the to-be-restored "data" directory. it check the database files, and compares the message files with the database. the new "gentestdata" subcommand generates a basic "data" directory, with a queue and a few accounts. we will use it in the future along with "verifydata" to test upgrades from old version to the latest version. both when going to the next version, and when skipping several versions. the script test-upgrades.sh executes these tests and doesn't do anything at the moment, because no releases have this subcommand yet. inspired by a failed upgrade attempt of a pre-release version.
82 lines
2.6 KiB
Makefile
82 lines
2.6 KiB
Makefile
default: build
|
|
|
|
build:
|
|
# build early to catch syntax errors
|
|
CGO_ENABLED=0 go build
|
|
CGO_ENABLED=0 go vet -tags integration ./...
|
|
./gendoc.sh
|
|
(cd http && CGO_ENABLED=0 go run ../vendor/github.com/mjl-/sherpadoc/cmd/sherpadoc/*.go -adjust-function-names none Admin) >http/adminapi.json
|
|
(cd http && CGO_ENABLED=0 go run ../vendor/github.com/mjl-/sherpadoc/cmd/sherpadoc/*.go -adjust-function-names none Account) >http/accountapi.json
|
|
# build again, files above are embedded
|
|
CGO_ENABLED=0 go build
|
|
|
|
test:
|
|
CGO_ENABLED=0 go test -shuffle=on -coverprofile cover.out ./...
|
|
go tool cover -html=cover.out -o cover.html
|
|
|
|
test-race:
|
|
CGO_ENABLED=1 go test -race -shuffle=on -covermode atomic -coverprofile cover.out ./...
|
|
go tool cover -html=cover.out -o cover.html
|
|
|
|
test-upgrade:
|
|
./test-upgrade.sh
|
|
|
|
check:
|
|
staticcheck ./...
|
|
staticcheck -tags integration
|
|
|
|
# having "err" shadowed is common, best to not have others
|
|
check-shadow:
|
|
go vet -vettool=$$(which shadow) ./... 2>&1 | grep -v '"err"'
|
|
|
|
fuzz:
|
|
go test -fuzz FuzzParseSignature -fuzztime 5m ./dkim
|
|
go test -fuzz FuzzParseRecord -fuzztime 5m ./dkim
|
|
go test -fuzz . -fuzztime 5m ./dmarc
|
|
go test -fuzz . -fuzztime 5m ./dmarcrpt
|
|
go test -fuzz . -parallel 1 -fuzztime 5m ./imapserver
|
|
go test -fuzz . -parallel 1 -fuzztime 5m ./junk
|
|
go test -fuzz FuzzParseRecord -fuzztime 5m ./mtasts
|
|
go test -fuzz FuzzParsePolicy -fuzztime 5m ./mtasts
|
|
go test -fuzz . -parallel 1 -fuzztime 5m ./smtpserver
|
|
go test -fuzz . -fuzztime 5m ./spf
|
|
go test -fuzz FuzzParseRecord -fuzztime 5m ./tlsrpt
|
|
go test -fuzz FuzzParseMessage -fuzztime 5m ./tlsrpt
|
|
|
|
integration-build:
|
|
docker-compose -f docker-compose-integration.yml build --no-cache moxmail
|
|
|
|
integration-start:
|
|
-rm -r testdata/integration/data
|
|
-docker-compose -f docker-compose-integration.yml run moxmail /bin/bash
|
|
docker-compose -f docker-compose-integration.yml down
|
|
|
|
# run from within "make integration-start"
|
|
integration-test:
|
|
CGO_ENABLED=0 go test -tags integration
|
|
|
|
imaptest-build:
|
|
-docker-compose -f docker-compose-imaptest.yml build --no-cache mox
|
|
|
|
imaptest-run:
|
|
-rm -r testdata/imaptest/data
|
|
mkdir testdata/imaptest/data
|
|
docker-compose -f docker-compose-imaptest.yml run --entrypoint /usr/local/bin/imaptest imaptest host=mox port=1143 user=mjl@mox.example pass=testtest mbox=imaptest.mbox
|
|
docker-compose -f docker-compose-imaptest.yml down
|
|
|
|
fmt:
|
|
go fmt ./...
|
|
gofmt -w -s *.go */*.go
|
|
|
|
jswatch:
|
|
inotifywait -m -e close_write http/admin.html http/account.html | xargs -n2 sh -c 'echo changed; ./checkhtmljs http/admin.html http/account.html'
|
|
|
|
jsinstall:
|
|
-mkdir -p node_modules/.bin
|
|
npm install jshint@2.13.2
|
|
|
|
docker:
|
|
docker build -t mox:dev .
|
|
|
|
docker-release:
|
|
./docker-release.sh
|