Fix system tests on CentOS 6:

- Work-around various SELinux permission type stuff.
 - Force .js to have the correct MIME type.
 - os_redirector.sh should load build_env as well as shell_utils.
This commit is contained in:
Steve Hill
2016-11-04 17:40:38 -04:00
parent 02d809531b
commit 5b9af6e606
4 changed files with 17 additions and 11 deletions
+3
View File
@@ -2058,6 +2058,9 @@ AddType image/webp .webp
# As above, for verifying JSON content-type in system/system_test.sh
AddType application/json .json
# Override CentOS which uses ancient default of text/javascript.
AddType application/javascript .js
#ALL_DIRECTIVES # Invoke all ModPagespeed* directives to make sure they work:
#ALL_DIRECTIVES ModPagespeedAllow foo
#ALL_DIRECTIVES ModPagespeedAddResourceHeader foo bar
+2 -1
View File
@@ -28,8 +28,9 @@ fi
target="$my_dir/$distro/$target_basename"
if [[ "$target" == *.sh ]]; then
# All the "dependent" scripts are going to want this, so just load it here.
# All the "dependent" scripts are going to want these, so just load them here.
source "$my_dir/shell_utils.sh" || exit 1
source "$my_dir/$distro/build_env.sh" || exit 1
source "$target" "$@"
else
exec "$target" "$@"
@@ -12,12 +12,13 @@ COLOR0=rgb\($COLOR_SUFFIX
COLOR1=rgb\(1$COLOR_SUFFIX
echo Clear out our existing state before we begin the test.
echo $SUDO touch $MOD_PAGESPEED_CACHE/cache.flush
$SUDO touch $MOD_PAGESPEED_CACHE/cache.flush
echo $SUDO touch ${MOD_PAGESPEED_CACHE}_secondary/cache.flush
$SUDO touch ${MOD_PAGESPEED_CACHE}_secondary/cache.flush
echo $SUDO touch ${MOD_PAGESPEED_CACHE}_ipro_for_browser/cache.flush
$SUDO touch ${MOD_PAGESPEED_CACHE}_ipro_for_browser/cache.flush
for flushfile in $MOD_PAGESPEED_CACHE/cache.flush \
${MOD_PAGESPEED_CACHE}_secondary/cache.flush \
${MOD_PAGESPEED_CACHE}_ipro_for_browser/cache.flush; do
echo $SUDO touch $flushfile
$SUDO touch $flushfile
$SUDO chcon --reference=${APACHE_DOC_ROOT} $flushfile || true
done
sleep 1
CACHE_TESTING_DIR="$APACHE_DOC_ROOT/cache_flush"
@@ -36,7 +37,7 @@ TMP_CSS_FILE=$TESTTMP/update.css
# the html.
echo "echo \".class myclass { color: $COLOR0; }\" > $CSS_FILE"
echo ".class myclass { color: $COLOR0; }" >$TMP_CSS_FILE
chmod ugo+r $TMP_CSS_FILE # in case the user's umask doesn't allow o+r
chmod a+r $TMP_CSS_FILE # in case the user's umask doesn't allow o+r
$SUDO cp $TMP_CSS_FILE $CSS_FILE
fetch_until $URL "grep -c $COLOR0" 1
@@ -53,6 +54,7 @@ NUM_INITIAL_FLUSHES=$(scrape_stat cache_flush_count)
# Now change the file to $COLOR1.
echo echo ".class myclass { color: $COLOR1; }" ">" $CSS_FILE
echo ".class myclass { color: $COLOR1; }" >$TMP_CSS_FILE
chmod a+r $TMP_CSS_FILE # in case the user's umask doesn't allow o+r
$SUDO cp $TMP_CSS_FILE $CSS_FILE
# We might have stale cache for 5 seconds, so the result might stay
+3 -3
View File
@@ -944,10 +944,10 @@ function cache_purge_test() {
check_from "$(read_metadata_cache $yellow_css)" fgrep -q cache_ok:true
check_from "$(read_metadata_cache $blue_css)" fgrep -q cache_ok:true
echo 'body { background: MediumPurple; }' > "/tmp/purple.$$"
$SUDO mv "/tmp/purple.$$" "$purple_file"
$SUDO cp "/tmp/purple.$$" "$purple_file"
http_proxy=$SECONDARY_HOSTNAME fetch_until "$purple_url" 'fgrep -c 9370db' 1
echo 'body { background: black; }' > "/tmp/purple.$$"
$SUDO mv "/tmp/purple.$$" "$purple_file"
$SUDO cp "/tmp/purple.$$" "$purple_file"
cache_purge $method "*"
@@ -986,5 +986,5 @@ function cache_purge_test() {
http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $PURGE_STATS_URL > $STATS.3
check_stat $STATS.2 $STATS.3 num_resource_fetch_successes 1
done
$SUDO rm -rf "$purple_dir"
$SUDO rm -rf "$purple_dir" "/tmp/purple.$$"
}