-
Notifications
You must be signed in to change notification settings - Fork 67
/
update_baseline.sh
executable file
·79 lines (68 loc) · 1.98 KB
/
update_baseline.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh
{
CACHE_VERSION_FILE=./test/baseline/.cache/version.json
if [ -f "$CACHE_VERSION_FILE" ]; then
HAS_DIFF=$(git diff --name-only origin/main:test/baseline/version.json $CACHE_VERSION_FILE)
if [[ ${HAS_DIFF} == "" ]]; then
exit 0
fi
fi
echo "~~~~~~~~~~~~~~~~~~~Update Baseline Start~~~~~~~~~~~~~~~~~~~~~"
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
CURRENT_COMMIT=$(git rev-parse HEAD)
STASH_LIST_BEFORE=$(git stash list)
git stash push --quiet
STASH_LIST_AFTER=$(git stash list)
git switch main --quiet
./install_tools.sh
depsync
if [[ $1 == "1" ]]; then
BUILD_DIR=build
else
BUILD_DIR=cmake-build-debug
fi
if [ ! -d "./${BUILD_DIR}" ]; then
mkdir ${BUILD_DIR}
fi
cd ${BUILD_DIR}
if [ -f "./CMakeCache.txt" ]; then
TEXT=$(cat ./CMakeCache.txt)
TEXT=${TEXT#*CMAKE_COMMAND:INTERNAL=}
for line in ${TEXT}; do
CMAKE_COMMAND=$line
break
done
fi
if [ ! -f "$CMAKE_COMMAND" ]; then
CMAKE_COMMAND="cmake"
fi
echo $CMAKE_COMMAND
if [[ $1 == "1" ]]; then
$CMAKE_COMMAND -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -g -O0" -DTGFX_USE_SWIFTSHADER=ON -DTGFX_BUILD_TESTS=ON -DTGFX_SKIP_BASELINE_CHECK=ON -DCMAKE_BUILD_TYPE=Debug ../
else
$CMAKE_COMMAND -DTGFX_BUILD_TESTS=ON -DTGFX_SKIP_BASELINE_CHECK=ON -DCMAKE_BUILD_TYPE=Debug ../
fi
$CMAKE_COMMAND --build . --target UpdateBaseline -- -j 12
./UpdateBaseline
if test $? -eq 0; then
echo "~~~~~~~~~~~~~~~~~~~Update Baseline Success~~~~~~~~~~~~~~~~~~~~~"
else
echo "~~~~~~~~~~~~~~~~~~~Update Baseline Failed~~~~~~~~~~~~~~~~~~"
COMPLIE_RESULT=false
fi
cd ..
if [[ $CURRENT_BRANCH == "HEAD" ]]; then
git checkout $CURRENT_COMMIT --quiet
else
git switch $CURRENT_BRANCH --quiet
fi
if [[ $STASH_LIST_BEFORE != "$STASH_LIST_AFTER" ]]; then
git stash pop --index --quiet
fi
depsync
if [ "$COMPLIE_RESULT" == false ]; then
mkdir -p result
cp -r test/out result
exit 1
fi
}