1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0-or-later 3# Copyright (c) 2017-2018 Oracle and/or its affiliates. All Rights Reserved. 4 5TST_CNT=3 6TST_TESTFUNC="test" 7TST_NEEDS_TMPDIR=1 8TST_NEEDS_ROOT=1 9 10. tst_net.sh 11 12compare() 13{ 14 local per=$(( $res0 * 100 / $res1 - 100 )) 15 16 if [ "$per" -gt "100" -o "$per" -lt "-100" ]; then 17 tst_res TFAIL "$1 performance $per %" 18 else 19 tst_res TPASS "$1 performance $per % in range -100 ... 100 %" 20 fi 21} 22 23test1() 24{ 25 tst_res TINFO "run UDP" 26 tst_netload -H $(tst_ipaddr rhost) -T udp 27 res0="$(cat tst_netload.res)" 28} 29test2() 30{ 31 tst_res TINFO "compare UDP/DCCP performance" 32 tst_netload -H $(tst_ipaddr rhost) -T dccp 33 res1="$(cat tst_netload.res)" 34 compare DCCP 35} 36test3() 37{ 38 tst_res TINFO "compare UDP/UDP-Lite performance" 39 tst_netload -H $(tst_ipaddr rhost) -T udp_lite 40 res1="$(cat tst_netload.res)" 41 compare UDP-Lite 42} 43 44tst_run 45