1#!/bin/sh 2# Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved. 3# 4# This program is free software; you can redistribute it and/or 5# modify it under the terms of the GNU General Public License as 6# published by the Free Software Foundation; either version 2 of 7# the License, or (at your option) any later version. 8# 9# This program is distributed in the hope that it would be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with this program. If not, see <http://www.gnu.org/licenses/>. 16# 17# Author: Alexey Kodanev <alexey.kodanev@oracle.com> 18 19TCID=dccp01 20TST_TOTAL=3 21TST_CLEANUP="cleanup" 22TST_NEEDS_TMPDIR=1 23 24. test_net.sh 25 26cleanup() 27{ 28 tst_rmdir 29} 30 31setup() 32{ 33 tst_require_root 34} 35 36test_run() 37{ 38 tst_resm TINFO "compare UDP/DCCP performance" 39 40 tst_netload -H $(tst_ipaddr rhost) -T udp 41 local res0="$(cat tst_netload.res)" 42 43 tst_netload -H $(tst_ipaddr rhost) -T dccp 44 local res1="$(cat tst_netload.res)" 45 46 local per=$(( $res0 * 100 / $res1 - 100 )) 47 48 if [ "$per" -gt "100" -o "$per" -lt "-100" ]; then 49 tst_resm TFAIL "dccp performance $per %" 50 else 51 tst_resm TPASS "dccp performance $per % in range -100 ... 100 %" 52 fi 53} 54 55setup 56test_run 57 58tst_exit 59