]> de.git.xonotic.org Git - xonotic/xonotic.git/blob - misc/tools/the-big-benchmark/the-big-benchmark.sh
e890b14458179f1a24823c73bc69596aba1ca9ce
[xonotic/xonotic.git] / misc / tools / the-big-benchmark / the-big-benchmark.sh
1 #!/bin/sh
2
3 set -e
4
5 if [ -d "${0%/*}" ]; then
6         cd "${0%/*}"
7 fi
8 cd ../../..
9
10 echo "The Big Benchmark"
11 echo " ================="
12 echo
13 if [ -f ./all ]; then
14         echo "WARNING: running this script will destroy ANY local changes you"
15         echo "might have on the repository that haven't been pushed yet."
16         echo
17         if [ x"$1" != x"--yes" ]; then
18                 echo "Are you absolutely sure you want to run this?"
19                 echo
20                 while :; do
21                         echo -n "y/n: "
22                         read -r yesno
23                         case "$yesno" in
24                                 y)
25                                         break
26                                         ;;
27                                 n)
28                                         echo "Aborted."
29                                         exit 1
30                                         ;;
31                         esac
32                 done
33         fi
34 fi
35
36 if [ -f ./all ]; then
37         ./all clean --reclone
38         ./all compile -r
39         export USE_GDB=no
40         set -- ./all run "$@"
41 elif [ -z "$*" ]; then
42         case "`uname`" in
43                 Darwin)
44                         set -- ./Xonotic.app/Contents/MacOS/xonotic-osx-sdl
45                         ;;
46                 Linux)
47                         set -- ./xonotic-linux-sdl.sh
48                         ;;
49                 *)
50                         echo "OS not detected. Usage:"
51                         echo "  $0 how-to-run-xonotic"
52                         echo "On Windows when using a release build or an autobuild,"
53                         echo "use the-big-benchmark.bat instead!"
54                         exit 1
55                         ;;
56         esac
57 fi
58 rm -f data/the-big-benchmark.log
59 rm -f data/benchmark.log
60 rm -f data/engine.log
61 p="+developer 1 -nohome -benchmarkruns 4 -benchmarkruns_skipfirst -benchmark demos/the-big-keybench.dem"
62 for e in omg low med normal high ultra ultimate; do
63         rm -f data/benchmark.log
64         echo + "$@" +exec effects-$e.cfg $p > data/engine.log
65         "$@" +exec effects-$e.cfg $p >>data/engine.log 2>&1 || true
66         if grep -xF ']quit' data/engine.log >/dev/null; then
67                 break
68         fi
69         cat data/engine.log >> data/the-big-benchmark.log
70         cat data/benchmark.log >> data/the-big-benchmark.log
71 done
72 if [ -f ./all ]; then
73         ./all clean -r -f -u
74 fi
75
76 rm -f data/benchmark.log
77 rm -f data/engine.log
78 if ! [ -f data/the-big-benchmark.log ]; then
79         echo
80         echo "The benchmark has been aborted. No log file has been written."
81         exit
82 fi
83
84 echo
85 echo "Please provide the the following info to the Xonotic developers:"
86 echo " - CPU speed"
87 echo " - memory size"
88 echo " - graphics card (which vendor, which model)"
89 echo " - operating system (including whether it is 32bit or 64bit)"
90 echo " - graphics driver version"
91 echo " - the file the-big-benchmark.log in the data directory"
92 echo
93 echo "Thank you"