Commit graph

28 commits

Author SHA1 Message Date
Anirudha Bose 2547246f84 GitHub Actions: Enable Go Race detector and code coverage
This modifies the goclean.sh script to run tests with the
race detector enabled. It also enables code coverage, and
uploads the results to coveralls.io.

Running tests with -race and -cover flags was disabled in
6487ba1 and 6788df7 respectively, due to some limits on
time/goroutines being hit on Travis CI. Since we have
migrated to GitHub Actions, it is desirable to bring them
back.
2020-09-08 10:19:55 -04:00
David Hill f7399e6157 build: clean linter warnings 2020-05-13 08:58:39 -04:00
David Hill a505b99ba3 build: replace travis-ci with github actions.
test go 1.14
use golangci-lint
2020-05-13 08:52:05 -04:00
Conner Fromknecht 2a9e4372c8
goclean: update for go modules 2018-11-29 17:45:40 -08:00
Olaoluwa Osuntokun 04f0b5338a build: switch to stable version of gometalinter 2018-05-15 20:47:29 -07:00
Dave Collins 6487ba1047
TravisCI: Don't run tests with race.
This modifies the goclean.sh script that is executed on Travis to
only run the tests without the race detector.

While it is nice to run the race detector on the tests, unfortunately
there is a limit to the number of goroutines that can be launched while
running it.  Since Travis is now much slower than it once was, this
causes a ton of false positive failures.
2017-07-01 16:13:35 -05:00
Dave Collins 6788df79f1
TravisCI: Only run tests once.
This modifies the goclean.sh script that is executed on Travis to
only run the tests once.

While it is nice to see coverage reports in the log, unfortunately it
appears that both the -race and -cover flags can't be used together, and
the tests have grown in complexity such that they are starting to get
close to TravisCI time limits.
2017-03-22 15:34:47 -05:00
Dave Collins efa50e6abc
multi: Simplify code per gosimple linter.
This simplifies the code based on the recommendations of the gosimple
lint tool.

Also, it increases the deadline for the linters to run to 10 minutes and
reduces the number of threads that is uses. This is being done because
the Travis environment has become increasingly slower and it also seems
to be hampered by too many threads running concurrently.
2017-03-22 15:34:13 -05:00
Dave Collins 28d42ba23c
build: Exclude .glide from test coverage.
The most recent version of glide creates a working directory named
.glide that includes .go files and thus must be excluded from the find
operation that generates merged test coverage of all packages.
2017-01-23 11:42:38 -06:00
David de Kloet 7a4cc89bbc goclean.sh: Make it more robust
Fail fast if glide or gometalinter isn't available.
And also fail if running glide or gometalinter fails.

Before goclean.sh could pass even if glide or gometalinter wasn't
available at all. It seems that even though we use `set -ex`, their
failure was hidden either inside the $() or behind the pipe.
2016-12-09 23:06:51 +01:00
John C. Vernaleo 53edcec224 Remove -v from go test.
This caused unhelpful clutter in travis output.

Closes #877
2016-12-07 10:10:06 -05:00
Dave Collins afec1bd124
build: Give linters longer and cleanup goclean.sh.
This modifies the goclean.sh script to expand the deadline for the
linters to run to 4 minutes and ensures the comments match reality.
2016-11-21 09:33:32 -06:00
Dave Collins fbb49ae349
build: Add unconvert linter to goclean.sh.
This modifies the goclean.sh script to include the unconvert lint tool
in the gometalinter configuration.

It also bumps the deadline to 45 seconds to give slower TravisCI
build servers more breathing room.
2016-11-03 13:32:35 -05:00
Dave Collins c180551348
build: Add gosimple linter to goclean.sh.
This modifies the goclean.sh script to include the gosimple lint tool to
the gometalinter configuration.
2016-11-03 13:24:06 -05:00
John C. Vernaleo 1e38d7fd4b Switch to gometalint in goclean
This switches `goclean` to use `gometalint` instead of running each checking tool one at a time.  The `gometalint` tool runs them concurrently.

More importantly it will allow us to easily add additional linters as desired.
2016-11-02 17:36:32 -05:00
Dave Collins fdfa07b0be
btcec: Consolidate tests into the btcec package.
Putting the test code in the same package makes it easier for forks
since they don't have to change the import paths as much and it also
gets rid of the need for internal_test.go to bridge.

Also, remove the exception from the lint checks about returning the
unexported type since it is no longer required.
2016-10-19 00:55:23 -05:00
Dave Collins 754c4fbe0c
rpctest: Gate rpctest-based behind a build tag.
This adds a new build tag named rpctest which must be set in order for
rpctest-based tests to be executed.  The new build tag is also added to
the goclean.sh script which is executed by Travis during continuous
integration builds.

This change is being made because the rpctest framework requires
additional careful user configuration to ensure the version of btcd
under test can be programmatically launched from the system path with
all of the necessary ports open whereas all of the other tests are
self-contained within the test binary itself.

Since said additional configuration is typically not done, it leads to a
lot of false positives.  Putting the tests behind a build tag allows
them to remain to be available and run during continuous integration
without imposing the additional configuration requirements on users.
2016-09-26 01:20:31 -05:00
Dave Collins 7cf9ec8190
rpctest: Use ports based on the process id.
This modifies the ports that are selected for use for the p2p and rpc
ports to start with a port that is based on the process id instead of a
hard-coded value.  The chosen ports are incremented for each running
instance similar to the previous code except the p2p and rpc ports and
now split into ranges instead of being 2 apart.

This is being done because the previous code only worked for a single
process which means it prevented the ability to run tests in parallel.

The new approach will work with multiple processes, however it must be
stated that there is still a very small probability that the stars could
align resulting in the same ports being selected.

Finally, this also reverts the recent change to run tests serially since
this fixes the underlying cause for that change.
2016-09-20 16:59:37 -05:00
Olaoluwa Osuntokun daac24626e build: execute tests across all packages serially
This modifies the goclean.sh to execute all the tests amongst
the packages serially. The default behavior of the `go test` command is
to execute all tests in parallel amongst the listed packages. This
behavior can at times cause tests which use the `rpctest` package to
fail due to multiple `btcd` nodes attempting to bind to the same port
simultaneously. As only one node can successfully bind to the port, the
btcd processes for the other concurrent harness instances exit silently
causing the RPC clients to fail with connection timeouts as their
target process no longer exists. Executing all tests serially
eliminates such a race condition which can cause non-deterministic test
failures.
2016-09-20 01:16:08 -05:00
Dave Collins 2554caee59 build: Convert project to use glide. (#689)
This converts the project to allow btcd to be used with the glide
package manager in order to provide stable and reproducible builds
without the user having to jump through all of the hoops as they do
today.

It consists of adding a glide.yaml file which identifies the project
dependencies and locations along with a glide.lock file which contains
the complete dependency tree pinned to specific versions.  Glide uses
these files to download the packages (or updates) to a local vendor
directory and checkout the correct pinned versions.  The go tool, in
turn, is used to build/install btcd and will use the pinned versions in
the vendor directory.

This also updates TravisCI to build using glide, removes some of the
exceptions in the lint checks which are no longer required, and updates
the README.md with the new instructions needed to build the project with
glide.
2016-05-06 10:47:53 -05:00
Dave Collins 5a9bac9668 Correct a few style related issues found by golint.
Also, update TravisCI goclean script to remove the special casing which
ignored 'Id' from the lint output since that exception is no longer
needed.  It was previously required due to the old version of btcjson,
but that is no longer in the repo.
2015-10-20 10:34:14 -05:00
Dave Collins e6d5c163d5 Update TravisCI to test against golang 1.5.1.
Also, modify the goclean.sh script to quote the test command arguments
and update the vet test to exclude recent false positives.
2015-09-17 11:01:34 -05:00
Dave Collins 6c12445fd5 build: Make goclean.sh script output more verbose.
This commit makes the goclean script print every line it is executing so
any failures are more obvious where they're coming from.

Closes #361.
2015-04-14 15:12:44 -05:00
Dave Collins 2519ff2856 Prepare lint exceptions for upcoming btcjson merge. 2015-02-19 11:22:02 -06:00
Dave Collins 15aa91514a Correct path to find in TravisCI goclean script.
Fixes #294.
2015-02-10 15:55:45 -06:00
Dave Collins 8134f68a4b Update TravisCI to ignore false positive in btcec.
Also correct format verb found by go vet.
2015-02-06 10:51:13 -06:00
Dave Collins 979d67627f Update for recent TravisCI changes.
Also, override the struct tag checking which is broken in the latest go
vet.
2015-02-05 14:07:27 -06:00
Dave Collins 642e3c741a Update TravisCI to goclean script.
This commit causes TravisCI to run several tools on each pull request and
commit to help ensure the code quality remains high.  This includes gofmt,
goimports, golint, go vet, the race detector, and coverage stats.

Also, it instructs TravisCI to use nicer container-based builds.
2015-01-30 22:21:39 -06:00