-
Notifications
You must be signed in to change notification settings - Fork 23
/
run_style_test.sh
executable file
·53 lines (46 loc) · 1.48 KB
/
run_style_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# -----------------------------------------------------------------------------
#
# Copyright (c) 2017 Sam Cox, Roberto Sommariva
#
# This file is part of the AtChem2 software package.
#
# This file is covered by the MIT license which can be found in the file
# LICENSE.md at the top level of the AtChem2 distribution.
#
# -----------------------------------------------------------------------------
# This script executes the style test on the Fortran files to ensure
# that they conform to the coding guidelines, described in the manual
# (doc/AtChem2-Manual.pdf)
#
# N.B.: the script MUST be run from the main directory of AtChem2.
LOG_FILE=tests/styletest.log
echo "Executing style script on:" > $LOG_FILE
echo "" >> $LOG_FILE
for file in src/*.f90 ; do
echo $file >> $LOG_FILE
python ./tools/fix_style.py $file $file.cmp &>/dev/null
this_style_file_failures=$(diff -q $file $file.cmp)
exitcode=$?
rm $file.cmp
if [ $exitcode -eq 1 ]; then
failed_style="$failed_style
$this_style_file_failures"
echo $file "FAILED" >> $LOG_FILE
elif [ $exitcode -ne 0 ]; then
echo "diff gave an error on" $file ". Aborting." >> $LOG_FILE
exit 1
fi
done
if [ -z "$failed_style" ]; then
echo "==> Style test PASSED"
style_test_passed=0
else
echo "==> Style test FAILED"
echo "$failed_style" >> $LOG_FILE
style_test_passed=1
fi
echo "" >> $LOG_FILE
echo "Execution of style script finished." >> $LOG_FILE
echo "==> Style test logfile:" $LOG_FILE
exit $style_test_passed