zsh completions: minor tweaks
[pcp.git] / qa / 372
blobfb51eddd8cd346bc5e54647f1b90fd1b49e73bc2
1 #!/bin/sh
2 # PCP QA Test No. 372
3 # simple exerciser for sheet2pcp - base CSV variant
5 # Copyright (c) 2010 Ken McDonell. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
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>
38 <datetime></datetime>
39 <data>metric.a</data>
40 <data>metric.b</data>
41 <data>metric.c</data>
42 <data>metric.d</data>
43 <data>metric.e</data>
44 </sheet>
45 End-of-File
47 echo "=== CSV ==="
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
52 echo
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
58 echo
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
64 echo
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
71 # success, all done
72 exit