Support run cyclictest on BareMetal
[yardstick.git] / yardstick / benchmark / scenarios / compute / unixbench_benchmark.bash
1 #!/bin/bash
2
3 ##############################################################################
4 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12 set -e
13
14 # Commandline arguments
15 OPTIONS="$@"
16 OUTPUT_FILE=/tmp/unixbench-out.log
17
18 # run unixbench test
19 run_unixbench()
20 {
21     cd /opt/tempT/UnixBench/
22     ./Run $OPTIONS > $OUTPUT_FILE
23 }
24
25 # write the result to stdout in json format
26 output_json()
27 {
28     single_score=$(awk '/Score/{print $7}' $OUTPUT_FILE | head -1 )
29     parallel_score=$(awk '/Score/{print $7}' $OUTPUT_FILE | tail -1 )
30     echo -e "{  \
31         \"single_score\":\"$single_score\", \
32         \"parallel_score\":\"$parallel_score\" \
33     }"
34 }
35
36 # main entry
37 main()
38 {
39     # run the test
40     run_unixbench
41
42     # output result
43     output_json
44 }
45
46 main