• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2################################################################################
3##                                                                            ##
4## This program is free software;  you can redistribute it and#or modify      ##
5## it under the terms of the GNU General Public License as published by       ##
6## the Free Software Foundation; either version 2 of the License, or          ##
7## (at your option) any later version.                                        ##
8##                                                                            ##
9## This program is distributed in the hope that it will be useful, but        ##
10## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
11## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
12## for more details.                                                          ##
13##                                                                            ##
14## You should have received a copy of the GNU General Public License          ##
15## along with this program;  if not, write to the Free Software               ##
16## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
17##                                                                            ##
18################################################################################
19#
20# File:          smt_smp_affinity.sh
21#
22# Description: This program tests the following:
23#		Set affinity through system call sched_setaffinity
24#		get affinity through system call sched_getaffinity
25#		Inheritance of Affinity
26#
27# Author:      Rohit Verma, rohit.170309@gmail.com
28#
29# History:     May 21 2009 - Created. - Rohit Verma
30
31export TST_TOTAL=1
32export TCID=smt_smp_affinity
33export TST_COUNT=1
34TFAILCNT=0
35RC=0
36
37# check for HT/SMP System
38tst_resm TINFO "Begin: SMT/SMP Affinity"
39
40if [ -f ./ht_enabled ];then
41	./ht_enabled
42	ret_value=$?
43
44	if [ $ret_value -ne 0 ];then
45		tst_resm TCONF "SMT/SMP is not supported"
46		tst_resm TINFO "End: SMT/SMP Affinity"
47		exit 0
48	fi
49else
50	tst_resm TBROK "ht_enabled:File not found"
51	tst_resm TINFO "End: SMT/SMP Affinity"
52	TFAILCNT=$(( $TFAILCNT+1 ))
53	exit $TFAILCNT
54fi
55
56no_of_processor=`tst_ncpus`
57no_of_cpu=`tst_ncpus_conf`
58
59if [ $no_of_processor -lt $no_of_cpu ];then
60
61	tst_resm TCONF "cpuX:offline"
62	tst_resm TINFO "End: SMT/SMP Affinity"
63	TFAILCNT=$(( $TFAILCNT+1 ))
64	exit $TFAILCNT
65
66else
67        cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | cut -f 2 -d ':'\
68			 | sed 's/ //' | uniq`
69
70	if [ $cpu_cores -ge 1 ];then
71		if [ -f ./ht_affinity ];then
72			./ht_affinity
73		else
74			tst_resm TBROK "ht_affinity:File not found"
75			tst_resm TINFO "End: SMT/SMP Affinity"
76			TFAILCNT=$(( $TFAILCNT+1 ))
77			exit $TFAILCNT
78		fi
79	else
80		tst_resm TINFO "TBD"
81	fi
82fi
83
84tst_resm TINFO "End: SMT/SMP Affinity"
85
86exit
87