Update sla check for scenarios
[yardstick.git] / yardstick / benchmark / scenarios / storage / fio_benchmark.bash
1 #!/bin/sh
2
3 ##############################################################################
4 # Copyright (c) 2015 Huawei Technologies Co.,Ltd.
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 FIO_FILENAME=$1
16 shift
17 OPTIONS="$@"
18
19 # setup data file for fio
20 setup()
21 {
22     if [ ! -f $FIO_FILENAME ]; then
23         dd if=/dev/zero of=$FIO_FILENAME bs=1M count=1024 oflag=direct > /dev/null 2>&1
24     fi
25 }
26
27 # run fio test and write json format result to stdout
28 run_test()
29 {
30     fio $OPTIONS
31 }
32
33 # main entry
34 main()
35 {
36     # setup the test
37     setup
38
39     # run the test
40     run_test
41 }
42
43 main
44