gorm/tests/tests_all.sh
2021-03-24 14:22:36 +08:00

42 lines
786 B
Bash
Executable File

#!/bin/bash -e
dialects=("sqlite" "mysql" "postgres" "sqlserver")
if [[ $(pwd) == *"gorm/tests"* ]]; then
cd ..
fi
if [ -d tests ]
then
cd tests
cd ..
fi
go get -u ./...
for dialect in "${dialects[@]}" ; do
if [ "$GORM_DIALECT" = "" ] || [ "$GORM_DIALECT" = "${dialect}" ]
then
echo "testing ${dialect}..."
if [ "$GORM_VERBOSE" = "" ]
then
GORM_DIALECT=${dialect} go test -race -count=1 ./...
if [ -d tests ]
then
cd tests
GORM_DIALECT=${dialect} go test -race -count=1 ./...
cd ..
fi
else
GORM_DIALECT=${dialect} go test -race -count=1 -v ./...
if [ -d tests ]
then
cd tests
GORM_DIALECT=${dialect} go test -race -count=1 -v ./...
cd ..
fi
fi
fi
done