2023-01-12 23:23:58 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
PACKAGE="$1"
|
|
|
|
echo "$PACKAGE"
|
2020-12-11 14:56:20 +00:00
|
|
|
|
2021-02-04 16:34:58 +00:00
|
|
|
psql -U lemmy -d postgres -c "DROP DATABASE lemmy;"
|
|
|
|
psql -U lemmy -d postgres -c "CREATE DATABASE lemmy;"
|
|
|
|
|
2020-07-10 18:16:42 +00:00
|
|
|
export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy
|
2021-04-05 17:21:56 +00:00
|
|
|
# tests are executed in working directory crates/api (or similar),
|
|
|
|
# so to load the config we need to traverse to the repo root
|
|
|
|
export LEMMY_CONFIG_LOCATION=../../config/config.hjson
|
2023-01-12 23:23:58 +00:00
|
|
|
export RUST_BACKTRACE=1
|
|
|
|
|
|
|
|
if [ -n "$PACKAGE" ];
|
|
|
|
then
|
|
|
|
cargo test -p $PACKAGE --all-features --no-fail-fast
|
|
|
|
else
|
|
|
|
cargo test --workspace --all-features --no-fail-fast
|
|
|
|
fi
|
|
|
|
|
2022-07-30 03:55:59 +00:00
|
|
|
# Add this to do printlns: -- --nocapture
|