Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI validate script #1399

Merged
merged 1 commit into from
Jul 25, 2020
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
14 changes: 7 additions & 7 deletions tests/ci/validate.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# This script is intended to be used to run tests that validate the correct
# packaging / install behavour of XDMoD. For example checking the
# packaging / install behavior of XDMoD. For example checking the
# file permissions are correct on the RPM packaged files.

exitcode=0
Expand All @@ -14,33 +14,33 @@ fi
for file in open_xdmod/build/*.tar.gz;
do
echo "Checking $file"
if tar tf $file | fgrep .eslintrc.json; then
if tar tf "${file}" | fgrep .eslintrc.json; then
echo "Error eslintrc files found in build tarball $file"
exitcode=1
fi
done

# Check that the unknown resource is in the database with key 0
unkrescount=$(echo 'SELECT COUNT(*) from resourcetype WHERE id = 0 and abbrev = '"'"'UNK'"'" | mysql -N modw)
if [ $unkrescount -ne 1 ];
if [[ "${unkrescount}" -ne 1 ]]
then
echo "Missing / inconsistent 'UNK' row in modw.resourcetype"
exitcode=1
fi

# Check that the various scripts have not left any files around in the tmp
# directory
FIND_CRITERIA='-type f -newer /usr/share/xdmod/html/index.php ( -user xdmod -o -user apache )'
if find /tmp $FIND_CRITERIA | grep -q .
FIND_CRITERIA=(-type f -newer /usr/share/xdmod/html/index.php '(' -user xdmod -o -user apache ')')
if find /tmp "${FIND_CRITERIA[@]}" | grep -q .
then
echo "Unexpected files found in temporary directory"
find /tmp $FIND_CRITERIA -print0 | xargs -0 ls -la
find /tmp "${FIND_CRITERIA[@]}" -print0 | xargs -0 ls -la
exitcode=1
fi

# ensure tables absent
tblcount=$(echo 'SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '"'"'moddb '"'"' AND table_name = '"'"'ReportTemplateACL'"'" | mysql -N information_schema)
if [ $tblcount -ne 0 ];
if [[ "${tblcount}" -ne 0 ]]
then
echo "Extraneous tables found in database"
fi
Expand Down