test_results_parse.awk 499 Bytes
Newer Older
Gerard Ryan's avatar
Gerard Ryan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
function quote(str) {
	return "\"" str "\""
}

BEGIN {
	C=","
	hdr = "******"
	backend=""
	cmd="INSERT INTO test_status (platform,backend,date,cases,passed)"
}

$1 == hdr && $2 == "Date" {
	datestamp = quote($3)
}

$1 == hdr && $2 == "Begin" && $3 == "Backend" {
	backend = quote($4)
}

$1 == hdr && $2 == "End" {
	print cmd, "VALUES ('PLATFORM'" C backend C datestamp C $5 C $3 ");"
	backend = ""
}

END {
	if( backend != "" )
		print cmd, "VALUES ('PLATFORM'" C backend C datestamp C 0 C 0 ");"
}