Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Backup and Restore Settings.ini on Tests #519

Merged
merged 1 commit into from Jun 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions extra/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ mysql -u "$DB_USER" --password="$DB_PWD" "$DB" -e "source $CODE_PATH/database/te
mysql -u "$DB_USER" --password="$DB_PWD" "$DB" -e "source $CODE_PATH/database/logos.sql;"
mysql -u "$DB_USER" --password="$DB_PWD" "$DB" -e "source $CODE_PATH/database/countries.sql;"

if [ -f "$CODE_PATH/settings.ini" ]; then
echo "[+] Backing up existing settings.ini"
cp "$CODE_PATH/settings.ini" "$CODE_PATH/settings.ini.bak"
fi

echo "[+] DB Connection file"
cat "$CODE_PATH/extra/settings.ini.example" | sed "s/DATABASE/$DB/g" | sed "s/MYUSER/$DB_USER/g" | sed "s/MYPWD/$DB_PWD/g" > "$CODE_PATH/settings.ini"

Expand All @@ -30,6 +35,11 @@ echo "[+] Deleting test database"
mysql -u "$DB_USER" --password="$DB_PWD" -e "DROP DATABASE IF EXISTS $DB;"
mysql -u "$DB_USER" --password="$DB_PWD" -e "FLUSH PRIVILEGES;"

if [ -f "$CODE_PATH/settings.ini.bak" ]; then
echo "[+] Restoring previous settings.ini"
mv "$CODE_PATH/settings.ini.bak" "$CODE_PATH/settings.ini"
fi

# In the future, we should use the hh_client exit status.
# Current there are some PHP built-ins not found in the hhi files upstream in HHVM.
echo "[+] Verifying HHVM Strict Compliance and Error Checking"
Expand Down