]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/tools/the-big-benchmark/the-big-benchmark.sh
damn slashes
[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
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 benchmark.log >> data/the-big-benchmark.log
71 done
72 rm -f data/benchmark.log
73 rm -f data/engine.log
74 if [ -f ./all ]; then
75         ./all clean -r -f -u
76 fi
77
78 echo
79 echo "Please provide the the following info to the Xonotic developers:"
80 echo " - CPU speed"
81 echo " - memory size"
82 echo " - graphics card (which vendor, which model)"
83 echo " - operating system (including whether it is 32bit or 64bit)"
84 echo " - graphics driver version"
85 echo " - the file the-big-benchmark.log in the data directory"
86 echo
87 echo "Thank you"