Skip to content

Commit

Permalink
Add initial root module
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusd committed Nov 16, 2022
1 parent 8b0538f commit 429d5de
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 0 deletions.
17 changes: 17 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ISC License

Copyright (c) 2013-2017 The btcsuite developers
Copyright (c) 2015-2020 The Decred developers
Copyright (c) 2017 The Lightning Network Developers

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Decred Binary Test Modules

This repository contains Go modules to write automated test scenarios involving
binaries for the [Decred](https://github.com/decred) project.

This is a work in progress repository.

5 changes: 5 additions & 0 deletions dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package dcrtest

import (
_ "github.com/decred/dcrtest/dcrdtest"
)
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module github.com/decred/dcrtest

go 1.18

require github.com/decred/dcrtest/dcrdtest v0.0.0-20221116180444-ea39cd8240db

replace github.com/decred/dcrdtest => ./dcrdtest

replace (
github.com/decred/dcrd/blockchain/stake/v5 => github.com/decred/dcrd/blockchain/stake/v5 v5.0.0-20221022042529-0a0cc3b3bf92
github.com/decred/dcrd/gcs/v4 => github.com/decred/dcrd/gcs/v4 v4.0.0-20221022042529-0a0cc3b3bf92
github.com/decred/dcrd/rpc/jsonrpc/types/v4 => github.com/decred/dcrd/rpc/jsonrpc/types/v4 v4.0.0-20221022042529-0a0cc3b3bf92
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/decred/dcrtest/dcrdtest v0.0.0-20221116180444-ea39cd8240db h1:cZvJgqcqYsaJSqlNqUOyzJ1wyNddeimkyIbStXUKQ4c=
github.com/decred/dcrtest/dcrdtest v0.0.0-20221116180444-ea39cd8240db/go.mod h1:PWuyQ4fjFmo23Eo37wZD5K1Ot6Dx+zacsp3K04tSa2Y=
52 changes: 52 additions & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/sh

set -e
#set -x

# The script does automatic checking on a Go package and its sub-packages,
# including:
# 1. gofmt (https://golang.org/cmd/gofmt/)
# 2. gosimple (https://github.com/dominikh/go-simple)
# 3. unconvert (https://github.com/mdempsky/unconvert)
# 4. ineffassign (https://github.com/gordonklaus/ineffassign)
# 5. go vet (https://golang.org/cmd/vet)
# 6. misspell (https://github.com/client9/misspell)
# 7. unused (http://honnef.co/go/tools/unused)

# golangci-lint (github.com/golangci/golangci-lint) is used to run each
# static checker.

go version

# run tests on all modules
ROOTPATH=$(go list -m)
ROOTPATHPATTERN=$(echo $ROOTPATH | sed 's/\\/\\\\/g' | sed 's/\//\\\//g')
MODPATHS=$(go list -m all | grep "^$ROOTPATHPATTERN" | sort | uniq | cut -d' ' -f1)
for module in $MODPATHS; do
# check linters
MODNAME=$(echo $module | sed -E -e "s/^$ROOTPATHPATTERN//" \
-e 's,^/,,' -e 's,/v[0-9]+$,,')
if [ -z "$MODNAME" ]; then
MODNAME=.
fi

# run commands in the module directory as a subshell
(
cd $MODNAME

go test ./...

# run linters
golangci-lint run --build-tags=rpctest --disable-all --deadline=10m \
--enable=gofmt \
--enable=gosimple \
--enable=unconvert \
--enable=ineffassign \
--enable=govet \
--enable=misspell \
--enable=unused \
)
done

echo "------------------------------------------"
echo "Tests completed successfully!"

0 comments on commit 429d5de

Please sign in to comment.