Use go standard path for test data

This commit is contained in:
Dimitrij Denissenko 2016-03-12 10:25:59 +00:00
parent eb78eedafe
commit e80f790e76
4 changed files with 7 additions and 7 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
*.rdb *.rdb
.test/ testdata/*/

View File

@ -2,13 +2,13 @@ all: testdeps
go test ./... -test.v -test.cpu=1,2,4 go test ./... -test.v -test.cpu=1,2,4
go test ./... -test.v -test.short -test.race go test ./... -test.v -test.short -test.race
testdeps: .test/redis/src/redis-server testdeps: testdata/redis/src/redis-server
.PHONY: all test testdeps .PHONY: all test testdeps
.test/redis: testdata/redis:
mkdir -p $@ mkdir -p $@
wget -qO- https://github.com/antirez/redis/archive/unstable.tar.gz | tar xvz --strip-components=1 -C $@ wget -qO- https://github.com/antirez/redis/archive/unstable.tar.gz | tar xvz --strip-components=1 -C $@
.test/redis/src/redis-server: .test/redis testdata/redis/src/redis-server: testdata/redis
cd $< && make all cd $< && make all

View File

@ -171,12 +171,12 @@ func (p *redisProcess) Close() error {
} }
var ( var (
redisServerBin, _ = filepath.Abs(filepath.Join(".test", "redis", "src", "redis-server")) redisServerBin, _ = filepath.Abs(filepath.Join("testdata", "redis", "src", "redis-server"))
redisServerConf, _ = filepath.Abs(filepath.Join(".test", "redis.conf")) redisServerConf, _ = filepath.Abs(filepath.Join("testdata", "redis.conf"))
) )
func redisDir(port string) (string, error) { func redisDir(port string) (string, error) {
dir, err := filepath.Abs(filepath.Join(".test", "instances", port)) dir, err := filepath.Abs(filepath.Join("testdata", "instances", port))
if err != nil { if err != nil {
return "", err return "", err
} }