3 # simple exerciser for sheet2pcp - base CSV variant
5 # Copyright (c) 2010 Ken McDonell. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
16 which sheet2pcp
>/dev
/null
2>&1
17 [ $?
-eq 0 ] || _notrun
"sheet2pcp not installed"
18 perl
-e "use XML::TokeParser" >/dev
/null
2>&1
19 [ $?
-eq 0 ] || _notrun
"perl XML::TokeParser module not installed"
20 perl
-e "use Spreadsheet::Read" >/dev
/null
2>&1
21 [ $?
-eq 0 ] || _notrun
"perl Spreadsheet::Read module not installed"
23 status
=0 # success is the default!
24 $sudo rm -rf $tmp.
* $seq.full
25 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
27 # real QA test starts here
29 cat <<'End-of-File' >$tmp.mapfile
30 <?xml version="1.0" encoding="UTF-8"?>
31 <!-- For PCP QA 372 -->
32 <sheet heading="1" hostname="time.greenwich.com" datefmt="DMY">
33 <metric sem="PM_SEM_COUNTER">metric.a</metric>
34 <metric sem="PM_SEM_COUNTER">metric.b</metric>
35 <metric>metric.c</metric>
36 <metric type="PM_TYPE_32">metric.d</metric>
37 <metric type="PM_TYPE_STRING">metric.e</metric>
48 rm -f $tmp.0 $tmp.index
$tmp.meta
49 sheet2pcp sheet
/simple.csv
$tmp.mapfile
$tmp 2>&1
50 [ -f $tmp.0 ] && pmdumplog
-az $tmp
53 echo "=== resaved CSV ==="
54 rm -f $tmp.0 $tmp.index
$tmp.meta
55 sheet2pcp sheet
/simple-resave.csv
$tmp.mapfile
$tmp 2>&1
56 [ -f $tmp.0 ] && pmdumplog
-az $tmp
59 echo "=== /dev/null ==="
60 rm -f $tmp.0 $tmp.index
$tmp.meta
61 sheet2pcp
/dev
/null
$tmp.mapfile
$tmp 2>&1
62 [ -f $tmp.0 ] && pmdumplog
-az $tmp
65 echo "=== bad datetime CSV ==="
66 rm -f $tmp.0 $tmp.index
$tmp.meta
67 cp sheet
/simple.csv
$tmp.baddate.csv
68 echo '34/13/2010 13:02:03;13;20;27;4;"bad-date"' >>$tmp.baddate.csv
69 sheet2pcp
$tmp.baddate.csv
$tmp.mapfile
$tmp 2>&1