diff --git a/run.sh b/run.sh index 75f353c..d8fcd49 100755 --- a/run.sh +++ b/run.sh @@ -13,8 +13,8 @@ SKIP_INIT=${3-false} # Configure WordPress versions -rm -rf old/.wp-env.override.json -rm -rf new/.wp-env.override.json +rm -f old/.wp-env.override.json +rm -f new/.wp-env.override.json if [[ $OLD_VERSION == 'trunk' ]]; then OLD_VERSION='master' @@ -27,19 +27,19 @@ fi echo "Old version: $OLD_VERSION" if [[ $OLD_VERSION != 'latest' ]]; then - if [[ "$OLD_VERSION" == *".zip"* ]]; then - echo "{\"core\":\"$OLD_VERSION\"}" >> old/.wp-env.override.json + if [[ $OLD_VERSION == *.zip* ]]; then + printf '{"core":"%s"}' "$OLD_VERSION" >> old/.wp-env.override.json else - echo "{\"core\":\"WordPress/WordPress#$OLD_VERSION\"}" >> old/.wp-env.override.json + printf '{"core":"WordPress/WordPress#%s"}' "$OLD_VERSION" >> old/.wp-env.override.json fi fi echo "New version: $NEW_VERSION" -if [[ "$NEW_VERSION" == *".zip"* ]]; then - echo "{\"core\":\"$NEW_VERSION\"}" >> new/.wp-env.override.json +if [[ "$NEW_VERSION" == *.zip* ]]; then + printf '{"core":"%s"}' "$NEW_VERSION" >> new/.wp-env.override.json else - echo "{\"core\":\"WordPress/WordPress#$NEW_VERSION\"}" >> new/.wp-env.override.json + printf '{"core":"WordPress/WordPress#%s"}' "$NEW_VERSION" >> new/.wp-env.override.json fi if [[ $SKIP_INIT != 'true' ]]; then @@ -105,9 +105,10 @@ npm run research --silent -- benchmark-server-timing -u http://localhost:8881/ npm run research --silent -- benchmark-server-timing -u http://localhost:8891/ -n 100 -p -o csv > after.csv node ../scripts/results.js "Server-Timing (Block Theme)" before.csv after.csv +cd - + # Install classic theme -cd ../ (cd old && npm run wp-env --silent run tests-cli wp theme activate twentytwentyone) (cd new && npm run wp-env --silent run tests-cli wp theme activate twentytwentyone) @@ -125,8 +126,9 @@ npm run research --silent -- benchmark-server-timing -u http://localhost:8881/ npm run research --silent -- benchmark-server-timing -u http://localhost:8891/ -n 100 -p -o csv > after.csv node ../scripts/results.js "Server-Timing (Classic Theme)" before.csv after.csv +cd - + # Shutdown sites again -cd ../ (cd old && npm run wp-env --silent stop) (cd new && npm run wp-env --silent stop)