1cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#!/usr/bin/awk -f
2cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#
3cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    Script for adding necessary dmesg clear/capture calls before executing
4cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    commands.
5cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#
6cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    Copyright (C) 2012, Linux Test Project.
7cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#
8cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    This program is free software; you can redistribute it and/or modify
9cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    it under the terms of the GNU General Public License as published by
10cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    the Free Software Foundation; either version 2 of the License, or
11cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    (at your option) any later version.
12cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#
13cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    This program is distributed in the hope that it will be useful,
14cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    but WITHOUT ANY WARRANTY; without even the implied warranty of
15cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    GNU General Public License for more details.
17cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#
18cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    You should have received a copy of the GNU General Public License along
19cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    with this program; if not, write to the Free Software Foundation, Inc.,
20cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#
22cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper# Garrett Cooper, April 2012
23cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper#
24cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper
25cb66da58002e53b35ff5131328d1ebab71161139Garrett CooperNF && ! /^#/ {
26cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper	print
27cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper	for (i = 1; i <= LOOPS; i++) {
28cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper		s = $1 "_loop_" i "_under_fault_kernel "
29cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper		if (i == 1) {
30cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper			s = s "$LTPROOT/bin/insert_kernel_faults.sh " PERCENTAGE "; "
31cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper		}
32cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper		for (j = 2; j <= NF; j++) {
33cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper			s = s " " $j
34cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper		}
35cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper		if (i == LOOPS) {
36cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper			s = s "; while ! $LTPROOT/bin/restore_kernel_faults_default.sh; do :; done"
37cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper		}
38cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper		print s
39cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper	}
40cb66da58002e53b35ff5131328d1ebab71161139Garrett Cooper}
41