rpms/kcbench/EL-6 kcbench,1.5,1.6 kcbench.spec,1.6,1.7

Thorsten Leemhuis thl at fedoraproject.org
Sun Jul 4 15:16:51 UTC 2010


Author: thl

Update of /cvs/pkgs/rpms/kcbench/EL-6
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv21729

Modified Files:
	kcbench kcbench.spec 
Log Message:
* Sun Jul 04 2010 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 0.3-6
- use type (bash built in) instead of which to check if all tools are available



Index: kcbench
===================================================================
RCS file: /cvs/pkgs/rpms/kcbench/EL-6/kcbench,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -r1.5 -r1.6
--- kcbench	24 Apr 2010 16:01:42 -0000	1.5
+++ kcbench	4 Jul 2010 15:16:51 -0000	1.6
@@ -25,7 +25,7 @@
 
 # this is me
 myprog_name=kcbench
-myprog_version=0.3.1
+myprog_version=0.3.3
 
 # set some defaults -- called before cmdoptions are parsed
 kcbench_init ()
@@ -57,7 +57,7 @@ kcbench_startupchecks()
 {
 	# check for tools we need
 	for tool in make gcc ld awk /usr/bin/time; do
-		if ! which ${tool} &> /dev/null ; then
+		if ! type ${tool} &> /dev/null ; then
 			echo "Could not find ${tool}"
 			exit 2
 		fi
@@ -132,11 +132,14 @@ kcbench_startupchecks()
 		fi
 
 		# if the kcbench dir exists in dir_topoutput already just use it
-		if [[ -d "${dir_topoutput%%/}/${myprog_name}" ]]; then
-			readonly dir_outputtmp="${dir_topoutput%%/}/${myprog_name}"
-		else
-			readonly dir_outputtmp=$(mktemp -d ${dir_topoutput%%/}/${myprog_name})
+		if [[ ! -d "${dir_topoutput%%/}/${myprog_name}" ]]; then
+			if ! mkdir ${dir_topoutput%%/}/${myprog_name}; then
+				echo "Could not create ${dir_topoutput%%/}/${myprog_name}" >&2
+				exit 2
+			fi
 		fi
+		readonly dir_outputtmp="${dir_topoutput%%/}/${myprog_name}"
+
 	else
 		# use a tmp dir
 		readonly dir_outputtmp=$(mktemp -d -t ${myprog_name}.XXXXXXXXX)
@@ -251,10 +254,9 @@ kcbench_main()
 		if [[ "${show_result_from_cache_free_run}" ]]; then
 			kcbench_compile_kernel 2 ${default_number_of_jobs} run-0-fillcaches "Filling caches:     "
 		else
-			(( ${verboselevel} == 2 )) && kcbench_echo 1 2 -n "Filling caches:     This might take a while..."
+			(( ${verboselevel} == 2 )) && kcbench_echo 1 2 -n "Filling caches:     This might take a while... "
 			kcbench_compile_kernel 3 ${default_number_of_jobs} run-0-fillcaches "Fill cache run (${default_number_of_jobs})"
 			kcbench_echo 1 3 "-------------------------------------------------------------------------------"
-			(( ${verboselevel} == 2 )) && kcbench_echo 1 2 " Done"
 		fi
 	fi
 
@@ -274,7 +276,7 @@ kcbench_main()
 		done
 
 		if (( ${errorruns} > 0 )) ; then
-			kcbench_echo 1 1 "Total erroruns:     ${errorruns}"
+			kcbench_echo 1 1 "Total # of errors:  ${errorruns}"
 		fi
 
 		if [[ ! "${run_infinite}" ]]; then
@@ -359,6 +361,12 @@ parse_results ()
 	fi
 }
 
+kcbench_cleanup_builddir()
+{
+	# cleanup
+	kcbench_echo 1 3 "Cleaning up builddir"
+	make O="${dir_outputtmp}" -C "${dir_sources}" -j ${default_number_of_jobs} clean &> "${kcbench_logdir}/make_clean"
+}
 
 kcbench_compile_kernel()
 {
@@ -376,14 +384,18 @@ kcbench_compile_kernel()
 	if /usr/bin/time -o "${this_logfile}.time" -f 'E %E\ne %e\nS %S\nU %U\nP %P\nM %M\nF %F\nR %R\nW %W\nc %c\nw %w\nI %I\nO %O\nx %x' make O="${dir_outputtmp}" -C "${dir_sources}" -j ${this_nrjobs} vmlinux >> "${this_logfile}" 2>&1 ; then
 	#if /usr/bin/time -o "${this_logfile}.time" -f 'E %E\ne %e\nS %S\nU %U\nP %P\nM %M\nF %F\nR %R\nW %W\nc %c\nw %w\nI %I\nO %O\nx %x' dd if=/dev/urandom bs=10M count=1 2>/dev/null | md5sum >> "${this_logfile}" 2>&1 ; then	
 		parse_results "${this_logfile}.time" ${this_verboselevel} "${this_runtype}"
+		kcbench_cleanup_builddir
 	else
 		kcbench_echo 2 1 "Failed ($(date))."
+		kcbench_cleanup_builddir
 
 		if [[ "${savefailedlogs}" ]]; then
 			# safe log and continue
 			kcbench_echo 2 2 "Saving logfile to ${savefailedlogs}/kcbench-$(basename ${this_logfile})"
 			cp "${this_logfile}" "${savefailedlogs}/kcbench-$(basename ${this_logfile})"
-		elif [[ "${run_infinite}" ]]; then
+		fi
+
+		if [[ "${run_infinite}" ]]; then
 			return 1
 		else
 			# what to do with the logfile?
@@ -398,18 +410,14 @@ kcbench_compile_kernel()
 			kcbench_exit 2
 		fi
 	fi
-
-	# cleanup
-	kcbench_echo 1 3 "Cleaning up builddir"
-	make O="${dir_outputtmp}" -C "${dir_sources}" -j ${default_number_of_jobs} clean &> "${kcbench_logdir}/make_clean"
 }
 
 # basic information about the system
 kcebench_sysinfo()
 {
 	kcbench_echo 1 ${1} "Linux running:      $(uname -r) on $(uname -i) ($(uname -n))"
-	kcbench_echo 1 ${1} "Compiler:           $(gcc --version | head -n 1)"
 	kcbench_echo 1 ${1} "Processor Cores:    $(grep '^processor' < /proc/cpuinfo  | wc -l) -- $(grep 'model name' /proc/cpuinfo  | sed 's!model name\t: !!' | sort | uniq)"
+	kcbench_echo 1 ${1} "Compiler:           $(gcc --version | head -n 1)"
 	[[ -r /proc/memory ]] && kcbench_echo 1 ${1} "Memory:             $(( $(awk '/MemTotal:/ { print $2}' /proc/meminfo) / 1024  )) MByte"
 	kcbench_echo 1 ${1} "Linux compiled:     $(basename "${dir_sources}") (${dir_sources})"
 }


Index: kcbench.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kcbench/EL-6/kcbench.spec,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- kcbench.spec	24 Apr 2010 16:01:42 -0000	1.6
+++ kcbench.spec	4 Jul 2010 15:16:51 -0000	1.7
@@ -1,6 +1,6 @@
 Name:           kcbench
 Version:        0.3
-Release:        4%{?dist}
+Release:        6%{?dist}
 Summary:        Kernel compile benchmark
 
 Group:          Applications/System
@@ -54,6 +54,15 @@ rm -rf ${RPM_BUILD_ROOT}
 
 
 %changelog
+* Sun Jul 04 2010 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 0.3-6
+- use type (bash built in) instead of which to check if all tools are available
+
+* Mon May 24 2010 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 0.3-5
+- a few small adjutments
+-- a few output format adjustments
+-- fix cleaning up buildir
+-- create compiledir properly if specified manually
+
 * Sat Apr 24 2010 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 0.3-4.1
 - fix two typos -- one fixes #565325
 



More information about the scm-commits mailing list