2020-06-02 17:13:53 +03:00
|
|
|
dialects=("sqlite" "mysql" "postgres" "sqlserver")
|
2020-02-23 04:38:48 +03:00
|
|
|
|
|
|
|
if [[ $(pwd) == *"gorm/tests"* ]]; then
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
2020-06-19 13:44:19 +03:00
|
|
|
if [ -d tests ]
|
|
|
|
then
|
|
|
|
cd tests
|
|
|
|
cp go.mod go.mod.bak
|
|
|
|
sed '/gorm.io\/driver/d' go.mod.bak > go.mod
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
2020-02-23 04:38:48 +03:00
|
|
|
for dialect in "${dialects[@]}" ; do
|
|
|
|
if [ "$GORM_DIALECT" = "" ] || [ "$GORM_DIALECT" = "${dialect}" ]
|
|
|
|
then
|
2020-05-30 17:27:20 +03:00
|
|
|
echo "testing ${dialect}..."
|
|
|
|
|
2020-06-01 19:24:16 +03:00
|
|
|
race=""
|
2020-06-02 17:13:53 +03:00
|
|
|
if [ "$GORM_DIALECT" = "sqlserver" ]
|
2020-02-23 04:38:48 +03:00
|
|
|
then
|
2020-06-01 19:24:16 +03:00
|
|
|
race="-race"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$GORM_VERBOSE" = "" ]
|
|
|
|
then
|
2020-06-06 05:47:32 +03:00
|
|
|
GORM_DIALECT=${dialect} go test $race -count=1 ./...
|
|
|
|
if [ -d tests ]
|
|
|
|
then
|
|
|
|
cd tests
|
|
|
|
GORM_DIALECT=${dialect} go test $race -count=1 ./...
|
|
|
|
cd ..
|
|
|
|
fi
|
2020-02-23 04:38:48 +03:00
|
|
|
else
|
2020-06-06 05:47:32 +03:00
|
|
|
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
|
2020-02-23 04:38:48 +03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
2020-06-19 13:44:19 +03:00
|
|
|
|
|
|
|
if [ -d tests ]
|
|
|
|
then
|
|
|
|
cd tests
|
|
|
|
mv go.mod.bak go.mod
|
|
|
|
fi
|