Skip to content

Commit 484fa00

Browse files
committed
Add actual validation check.
1 parent e2b8085 commit 484fa00

2 files changed

Lines changed: 42 additions & 2 deletions

File tree

fio/fio_run

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ test_name="fio"
2424
arguments="$@"
2525
disk_options=""
2626
curdir=`pwd`
27+
header_txt="op,blocksize_KiB,njobs,ndisks,iodepth,bw_KiB_s,iops,clat_us,lat_us,slat_us,Start_Date,End_Date"
28+
script_dir=$(realpath $(dirname $0))
2729

2830
#
2931
# Check to see if the test tools directory exists. If it does, we do not need to
@@ -37,7 +39,7 @@ if [ ! -d "${TOOLS_BIN}" ]; then
3739
git clone $tools_git $TOOLS_BIN
3840
if [ $? -ne 0 ]; then
3941
echo "pulling git $tools_git failed."
40-
exit $E_GENERAL
42+
exit 101
4143
fi
4244
fi
4345

@@ -319,7 +321,7 @@ reduce_data()
319321
# Now sort the results csv files and place headers
320322
#
321323
$TOOLS_BIN/test_header_info --test_name ${test_name} --info_in_dir_name "$file 2,3 4,5,6 9,10" --results_file ${working_dir}/results_fio.csv
322-
echo "op:blocksize_KiB:njobs:ndisks:iodepth:bw_KiB_s:iops:clat_us:lat_us:slat_us" >> ${working_dir}/results_fio.csv
324+
echo $header_txt >> ${working_dir}/results_fio.csv
323325
for list in `ls -d results_*`; do
324326
pushd $list > /dev/null
325327
op_and_size=`echo $list | cut -d'_' -f 2`
@@ -400,6 +402,23 @@ reduce_io_data()
400402
popd
401403
done
402404
done
405+
#
406+
# Validate data
407+
#
408+
tmp_file=$(mktemp /tmp/fio_results.XXXXX)
409+
echo $header_txt > $tmp_file
410+
grep -v "^#" $working_dir/results_fio.csv | grep -v "^op" >> $tmp_file
411+
${TOOLS_BIN}/csv_to_json $to_json_flags --csv_file $tmp_file --output_file results_fio.json
412+
rtc=$?
413+
if [[ $rtc -ne 0 ]]; then
414+
exit out "Error: csv_to_json failed" $rtc
415+
fi
416+
${TOOLS_BIN}/verify_results $to_verify_flags --schema_file $script_dir/results_fio_schema.py --class_name Fio_Results --file results_fio.json
417+
418+
rtc=$?
419+
if [[ $rtc -ne 0 ]]; then
420+
exit_out "Error: fio data verification failed" $rtc
421+
fi
403422
}
404423

405424
# Create the required file systems.
@@ -1224,6 +1243,7 @@ if [[ $to_use_pcp -eq 1 ]]; then
12241243
shutdown_pcp
12251244
fi
12261245

1246+
12271247
if [ $file_count -ne 0 ]; then
12281248
if [ $lvm_disk -eq 1 ]; then
12291249
$TOOLS_BIN/lvm_delete --lvm_vol fio --lvm_grp fio --mount_pnt /perf1

fio/results_fio_schema.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import pydantic
2+
import datetime
3+
from enum import Enum
4+
class Benchmark(Enum):
5+
read = "read"
6+
write = "write"
7+
8+
class Fio_Results (pydantic.BaseModel):
9+
op: Benchmark
10+
blocksize_KiB: int = pydantic.Field(gt=0)
11+
njobs: int = pydantic.Field(gt=0)
12+
ndisks: int = pydantic.Field(gt=0)
13+
iodepth: int = pydantic.Field(gt=0)
14+
bw_KiB_s: float = pydantic.Field(gt=0, allow_inf_nan=False)
15+
iops: float = pydantic.Field(gt=0, allow_inf_nan=False)
16+
clat_us: int = pydantic.Field(ge=0)
17+
lat_us: int = pydantic.Field(ge=0)
18+
slat_us: int = pydantic.Field(ge=0)
19+
Start_Date: datetime.datetime
20+
End_Date: datetime.datetime

0 commit comments

Comments
 (0)