~percona-toolkit-dev/percona-toolkit/pt-table-sync-binlog-format-only-if-not-statement

« back to all changes in this revision

Viewing changes to t/lib/bash/report_system_info.sh

MergeĀ lp:~percona-toolkit-dev/percona-toolkit/fix-945079-tmpdir-should-use-TEMP

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
. "$LIB_DIR/report_formatting.sh"
10
10
. "$LIB_DIR/report_system_info.sh"
11
11
 
12
 
TMPDIR="$TEST_TMPDIR"
 
12
PT_TMPDIR="$TEST_PT_TMPDIR"
13
13
PATH="$PATH:$PERCONA_TOOLKIT_SANDBOX/bin"
14
14
TOOL="pt-summary"
15
15
 
18
18
 
19
19
# parse_proc_cpuinfo
20
20
 
21
 
cat <<EOF > "$TMPDIR/expected"
 
21
cat <<EOF > "$PT_TMPDIR/expected"
22
22
  Processors | physical = 1, cores = 2, virtual = 2, hyperthreading = no
23
23
      Speeds | 2x1300.000
24
24
      Models | 2xGenuine Intel(R) CPU U7300 @ 1.30GHz
25
25
      Caches | 2x3072 KB
26
26
EOF
27
27
 
28
 
parse_proc_cpuinfo "$samples/proc_cpuinfo001.txt" > "$TMPDIR/got"
29
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_proc_cpuinfo, proc_cpuinfo001.txt"
 
28
parse_proc_cpuinfo "$samples/proc_cpuinfo001.txt" > "$PT_TMPDIR/got"
 
29
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_proc_cpuinfo, proc_cpuinfo001.txt"
30
30
 
31
 
cat <<EOF > "$TMPDIR/expected"
 
31
cat <<EOF > "$PT_TMPDIR/expected"
32
32
  Processors | physical = 1, cores = 1, virtual = 2, hyperthreading = yes
33
33
      Speeds | 2x1000.000
34
34
      Models | 2xIntel(R) Atom(TM) CPU N455 @ 1.66GHz
35
35
      Caches | 2x512 KB
36
36
EOF
37
37
 
38
 
parse_proc_cpuinfo "$samples/proc_cpuinfo002.txt" > "$TMPDIR/got"
39
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_proc_cpuinfo, proc_cpuinfo002.txt"
 
38
parse_proc_cpuinfo "$samples/proc_cpuinfo002.txt" > "$PT_TMPDIR/got"
 
39
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_proc_cpuinfo, proc_cpuinfo002.txt"
40
40
 
41
41
# parse_ethtool
42
 
cat <<EOF > "$TMPDIR/in"
 
42
cat <<EOF > "$PT_TMPDIR/in"
43
43
Settings for eth0:
44
44
   Supported ports: [ TP MII ]
45
45
   Supported link modes:   10baseT/Half 10baseT/Full 
62
62
   Link detected: no
63
63
EOF
64
64
 
65
 
cat <<EOF > "$TMPDIR/expected"
 
65
cat <<EOF > "$PT_TMPDIR/expected"
66
66
  Device    Speed     Duplex
67
67
  ========= ========= =========
68
68
  eth0       10Mb/s     Half      
69
69
EOF
70
70
 
71
 
parse_ethtool "$TMPDIR/in" > "$TMPDIR/got"
 
71
parse_ethtool "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
72
72
no_diff \
73
 
   "$TMPDIR/expected" \
74
 
   "$TMPDIR/got" \
 
73
   "$PT_TMPDIR/expected" \
 
74
   "$PT_TMPDIR/got" \
75
75
   "parse_ethtool works"
76
76
 
77
 
cat <<EOF > "$TMPDIR/in"
 
77
cat <<EOF > "$PT_TMPDIR/in"
78
78
Settings for eth0:
79
79
   Supported ports: [ TP MII ]
80
80
   Supported link modes:   10baseT/Half 10baseT/Full 
117
117
   Link detected: no
118
118
EOF
119
119
 
120
 
cat <<EOF > "$TMPDIR/expected"
 
120
cat <<EOF > "$PT_TMPDIR/expected"
121
121
  Device    Speed     Duplex
122
122
  ========= ========= =========
123
123
  eth0       10Mb/s     Half      
124
124
  eth4       100Mb/s    Full      
125
125
EOF
126
126
 
127
 
parse_ethtool "$TMPDIR/in" > "$TMPDIR/got"
 
127
parse_ethtool "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
128
128
no_diff \
129
 
   "$TMPDIR/expected" \
130
 
   "$TMPDIR/got" \
 
129
   "$PT_TMPDIR/expected" \
 
130
   "$PT_TMPDIR/got" \
131
131
   "parse_ethtool works if there are multiple devices"
132
132
 
133
133
# parse_netstat
134
134
 
135
 
cat <<EOF > $TMPDIR/expected
 
135
cat <<EOF > $PT_TMPDIR/expected
136
136
  Connections from remote IP addresses
137
137
    192.168.243.72      1
138
138
    192.168.243.81      2
144
144
    ESTABLISHED         4
145
145
    LISTEN             15
146
146
EOF
147
 
parse_netstat "$samples/netstat-001.txt" > "$TMPDIR/got"
148
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_netstat, netstat-001.txt"
 
147
parse_netstat "$samples/netstat-001.txt" > "$PT_TMPDIR/got"
 
148
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_netstat, netstat-001.txt"
149
149
 
150
 
cat <<EOF > "$TMPDIR/expected"
 
150
cat <<EOF > "$PT_TMPDIR/expected"
151
151
  Connections from remote IP addresses
152
152
    10.14.82.196      175
153
153
    10.14.82.200       10
181
181
    LISTEN             15
182
182
    TIME_WAIT        1250
183
183
EOF
184
 
parse_netstat "$samples/netstat-002.txt" > "$TMPDIR/got"
185
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_netstat, netstat-002.txt"
 
184
parse_netstat "$samples/netstat-002.txt" > "$PT_TMPDIR/got"
 
185
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_netstat, netstat-002.txt"
186
186
 
187
 
cat <<EOF > "$TMPDIR/expected"
 
187
cat <<EOF > "$PT_TMPDIR/expected"
188
188
  Connections from remote IP addresses
189
189
    10.8.0.12           6
190
190
    10.8.0.14           2
210
210
    TIME_WAIT           3
211
211
EOF
212
212
 
213
 
parse_netstat "$samples/netstat-003.txt" > "$TMPDIR/got"
214
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_netstat, netstat-003.txt"
 
213
parse_netstat "$samples/netstat-003.txt" > "$PT_TMPDIR/got"
 
214
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_netstat, netstat-003.txt"
215
215
 
216
216
# parse_lsi_megaraid
217
217
 
218
 
cat <<EOF > "$TMPDIR/expected"
 
218
cat <<EOF > "$PT_TMPDIR/expected"
219
219
         BBU | 100% Charged, Temperature 18C, isSOHGood=Yes
220
220
EOF
221
221
 
222
 
cat <<EOF > "$TMPDIR/in"
 
222
cat <<EOF > "$PT_TMPDIR/in"
223
223
BBU status for Adapter: 0
224
224
 
225
225
BatteryType: BBU
250
250
 
251
251
Exit Code: 0x00
252
252
EOF
253
 
parse_lsi_megaraid_bbu_status "$TMPDIR/in" > "$TMPDIR/got"
254
 
no_diff "$TMPDIR/got" "$TMPDIR/expected"
 
253
parse_lsi_megaraid_bbu_status "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
 
254
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"
255
255
 
256
256
# ############################################################################
257
 
cat <<EOF > "$TMPDIR/expected"
 
257
cat <<EOF > "$PT_TMPDIR/expected"
258
258
 
259
259
  PhysiclDev Type State   Errors Vendor  Model        Size
260
260
  ========== ==== ======= ====== ======= ============ ===========
264
264
  Hard Disk  SAS  Online   0/0/0 SEAGATE ST373455SS   70007MB
265
265
EOF
266
266
 
267
 
cat <<EOF > "$TMPDIR/in"
 
267
cat <<EOF > "$PT_TMPDIR/in"
268
268
                                     
269
269
Adapter #0
270
270
 
351
351
 
352
352
Exit Code: 0x00
353
353
EOF
354
 
parse_lsi_megaraid_devices "$TMPDIR/in" > "$TMPDIR/got"
355
 
no_diff "$TMPDIR/got" "$TMPDIR/expected"
 
354
parse_lsi_megaraid_devices "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
 
355
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"
356
356
 
357
357
 
358
358
# ############################################################################
359
 
cat <<EOF > "$TMPDIR/expected"
 
359
cat <<EOF > "$PT_TMPDIR/expected"
360
360
 
361
361
  PhysiclDev Type State   Errors Vendor  Model        Size
362
362
  ========== ==== ======= ====== ======= ============ ===========
366
366
  Hard Disk  SAS  Online   0/0/0 SEAGATE ST373455SS   70007MB
367
367
EOF
368
368
 
369
 
cat <<EOF > "$TMPDIR/in"
 
369
cat <<EOF > "$PT_TMPDIR/in"
370
370
[root@pc-db1 ~]# /opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aALL
371
371
                                     
372
372
Adapter #0
487
487
 
488
488
Exit Code: 0x00
489
489
EOF
490
 
parse_lsi_megaraid_devices "$TMPDIR/in" > "$TMPDIR/got"
491
 
no_diff "$TMPDIR/got" "$TMPDIR/expected"
 
490
parse_lsi_megaraid_devices "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
 
491
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"
492
492
 
493
493
# ############################################################################
494
 
cat <<EOF > "$TMPDIR/expected"
 
494
cat <<EOF > "$PT_TMPDIR/expected"
495
495
 
496
496
  VirtualDev Size      RAID Level Disks SpnDpth Stripe Status  Cache
497
497
  ========== ========= ========== ===== ======= ====== ======= =========
499
499
  1(no name) 69376MB   1 (1-0-0)      2     1-1   64kB Optimal WB, no RA
500
500
EOF
501
501
 
502
 
cat <<EOF > "$TMPDIR/in"
 
502
cat <<EOF > "$PT_TMPDIR/in"
503
503
[root@pc-db1 ~]# /opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aALL
504
504
                                     
505
505
Adapter #0
620
620
 
621
621
Exit Code: 0x00
622
622
EOF
623
 
parse_lsi_megaraid_virtual_devices "$TMPDIR/in" > "$TMPDIR/got"
624
 
no_diff "$TMPDIR/got" "$TMPDIR/expected"
 
623
parse_lsi_megaraid_virtual_devices "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
 
624
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"
625
625
 
626
626
# ############################################################################
627
 
cat <<EOF > "$TMPDIR/expected"
 
627
cat <<EOF > "$PT_TMPDIR/expected"
628
628
 
629
629
  VirtualDev Size      RAID Level Disks SpnDpth Stripe Status  Cache
630
630
  ========== ========= ========== ===== ======= ====== ======= =========
632
632
  1(no name) 69376MB   1 (1-0-0)      2      1-   64kB Optimal WB, no RA
633
633
EOF
634
634
 
635
 
cat <<EOF > "$TMPDIR/in"
 
635
cat <<EOF > "$PT_TMPDIR/in"
636
636
[root@pc-db1 ~]# /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aAll
637
637
                                     
638
638
 
664
664
 
665
665
Exit Code: 0x00
666
666
EOF
667
 
parse_lsi_megaraid_virtual_devices "$TMPDIR/in" > "$TMPDIR/got"
668
 
no_diff "$TMPDIR/got" "$TMPDIR/expected"
 
667
parse_lsi_megaraid_virtual_devices "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
 
668
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"
669
669
 
670
670
 
671
671
# ############################################################################
672
 
cat <<EOF > "$TMPDIR/expected"
 
672
cat <<EOF > "$PT_TMPDIR/expected"
673
673
       Model | PERC 6/i Integrated, PCIE interface, 8 ports
674
674
       Cache | 256MB Memory, BBU Present
675
675
EOF
676
676
 
677
 
parse_lsi_megaraid_adapter_info "$samples/MegaCli64_AdpAllInfo_aALL001.txt" > "$TMPDIR/got"
678
 
no_diff "$TMPDIR/got" "$TMPDIR/expected"
 
677
parse_lsi_megaraid_adapter_info "$samples/MegaCli64_AdpAllInfo_aALL001.txt" > "$PT_TMPDIR/got"
 
678
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"
679
679
 
680
680
# Launchpad 886223
681
 
cat <<EOF > "$TMPDIR/expected"
 
681
cat <<EOF > "$PT_TMPDIR/expected"
682
682
 
683
683
  VirtualDev Size      RAID Level Disks SpnDpth Stripe Status  Cache
684
684
  ========== ========= ========== ===== ======= ====== ======= =========
685
685
  0(no name)  135.5 GB 0 (:-1-0)      2 Depth-2  64 KB Optimal WB, no RA
686
686
EOF
687
 
parse_lsi_megaraid_virtual_devices "$PERCONA_TOOLKIT_BRANCH/t/pt-summary/samples/MegaCli64_LdPdInfo_aALL_886223" > "$TMPDIR/got"
688
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "Bug 886223"
 
687
parse_lsi_megaraid_virtual_devices "$PERCONA_TOOLKIT_BRANCH/t/pt-summary/samples/MegaCli64_LdPdInfo_aALL_886223" > "$PT_TMPDIR/got"
 
688
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Bug 886223"
689
689
 
690
690
# parse_hpacucli
691
691
 
692
 
cat <<EOF > "$TMPDIR/expected"
 
692
cat <<EOF > "$PT_TMPDIR/expected"
693
693
      logicaldrive 1 (136.7 GB, RAID 1, OK)
694
694
      physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 146 GB, OK)
695
695
      physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 146 GB, OK)
696
696
EOF
697
697
 
698
 
cat <<EOF > "$TMPDIR/in"
 
698
cat <<EOF > "$PT_TMPDIR/in"
699
699
 
700
700
Smart Array P400i in Slot 0 (Embedded)    (sn: PH73MU7325     )
701
701
 
708
708
      physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 146 GB, OK)
709
709
 
710
710
EOF
711
 
parse_hpacucli "$TMPDIR/in" > "$TMPDIR/got"
712
 
no_diff "$TMPDIR/got" "$TMPDIR/expected"
 
711
parse_hpacucli "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
 
712
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"
713
713
 
714
 
parse_hpacucli "$samples/hpaculi-003.txt" > "$TMPDIR/got"
 
714
parse_hpacucli "$samples/hpaculi-003.txt" > "$PT_TMPDIR/got"
715
715
is \
716
 
   "$(cat "$TMPDIR/got")" \
 
716
   "$(cat "$PT_TMPDIR/got")" \
717
717
   "" \
718
718
   "parse_hpacucli, hpaculi-003.txt"
719
719
 
720
720
# parse_fusionmpt_lsiutil
721
721
 
722
 
cat <<EOF > "$TMPDIR/expected"
 
722
cat <<EOF > "$PT_TMPDIR/expected"
723
723
 
724
724
  /proc/mpt/ioc0    LSI Logic SAS1068E B3    MPT 105   Firmware 00192f00   IOC 0
725
725
   B___T___L  Type       Vendor   Product          Rev      SASAddress     PhyNum
733
733
   0   3  PhysDisk 2     SEAGATE  ST3146855SS      S52A  5000c500130fcaed     3
734
734
   0  10  PhysDisk 3     SEAGATE  ST3146855SS      S52A  5000c500131093f5     2
735
735
EOF
736
 
parse_fusionmpt_lsiutil "$samples/lsiutil-001.txt" > "$TMPDIR/got"
737
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "lsiutil-001.txt"
 
736
parse_fusionmpt_lsiutil "$samples/lsiutil-001.txt" > "$PT_TMPDIR/got"
 
737
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lsiutil-001.txt"
738
738
 
739
 
cat <<EOF > "$TMPDIR/expected"
 
739
cat <<EOF > "$PT_TMPDIR/expected"
740
740
 
741
741
  /proc/mpt/ioc0    LSI Logic SAS1064E B3    MPT 105   Firmware 011e0000   IOC 0
742
742
   B___T___L  Type       Vendor   Product          Rev      SASAddress     PhyNum
746
746
   0   2  PhysDisk 0     IBM-ESXS ST9300603SS   F  B536  5000c5001d784329     1
747
747
   0   3  PhysDisk 1     IBM-ESXS MBD2300RC        SB17  500000e113c17152     0
748
748
EOF
749
 
parse_fusionmpt_lsiutil "$samples/lsiutil-002.txt" > "$TMPDIR/got"
750
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "lsiutil-002.txt"
 
749
parse_fusionmpt_lsiutil "$samples/lsiutil-002.txt" > "$PT_TMPDIR/got"
 
750
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lsiutil-002.txt"
751
751
 
752
 
cat <<EOF > "$TMPDIR/expected"
 
752
cat <<EOF > "$PT_TMPDIR/expected"
753
753
 
754
754
  /proc/mpt/ioc0    LSI Logic SAS1064E B3    MPT 105   Firmware 011e0000   IOC 0
755
755
   B___T___L  Type       Vendor   Product          Rev      SASAddress     PhyNum
759
759
   0   2  PhysDisk 0     IBM-ESXS MBD2300RC        SB17  500000e113c00ed2     1
760
760
   0   3  PhysDisk 1     IBM-ESXS MBD2300RC        SB17  500000e113c17ee2     0
761
761
EOF
762
 
parse_fusionmpt_lsiutil "$samples/lsiutil-003.txt" > "$TMPDIR/got"
763
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "lsiutil-003.txt"
 
762
parse_fusionmpt_lsiutil "$samples/lsiutil-003.txt" > "$PT_TMPDIR/got"
 
763
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lsiutil-003.txt"
764
764
 
765
765
# parse_free_minus_b
766
766
 
767
 
cat <<EOF > "$TMPDIR/expected"
 
767
cat <<EOF > "$PT_TMPDIR/expected"
768
768
       Total | 3.9G
769
769
        Free | 1.4G
770
770
        Used | physical = 2.5G, swap allocated = 4.9G, swap used = 0.0, virtual = 2.5G
773
773
       Dirty | 60 kB
774
774
EOF
775
775
 
776
 
cat <<EOF > "$TMPDIR/in"
 
776
cat <<EOF > "$PT_TMPDIR/in"
777
777
             total       used       free     shared    buffers     cached
778
778
Mem:    4182048768 2653696000 1528352768          0  138240000 2060787712
779
779
-/+ buffers/cache:  454668288 3727380480
824
824
DirectMap4k:       10232 kB
825
825
DirectMap2M:      897024 kB
826
826
EOF
827
 
parse_free_minus_b "$TMPDIR/in" > "$TMPDIR/got"
828
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_free_minus_b"
 
827
parse_free_minus_b "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
 
828
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_free_minus_b"
829
829
 
830
830
# Bug 993436: Memory: Total reports M when it should say G
831
 
cat <<EOF > "$TMPDIR/expected"
 
831
cat <<EOF > "$PT_TMPDIR/expected"
832
832
       Total | 1010.5M
833
833
        Free | 784.4M
834
834
        Used | physical = 226.1M, swap allocated = 2.0G, swap used = 0.0, virtual = 226.1M
836
836
      Caches | 122.2M
837
837
       Dirty | 152 kB
838
838
EOF
839
 
parse_free_minus_b "$T_DIR/pt-summary/samples/Linux/002/memory" > "$TMPDIR/got"
840
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_free_minus_b (bug 993436)"
 
839
parse_free_minus_b "$T_DIR/pt-summary/samples/Linux/002/memory" > "$PT_TMPDIR/got"
 
840
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_free_minus_b (bug 993436)"
841
841
 
842
842
# parse_filesystems
843
843
 
844
 
cat <<EOF > $TMPDIR/expected
 
844
cat <<EOF > $PT_TMPDIR/expected
845
845
  Filesystem  Size Used Type  Opts Mountpoint
846
846
  /dev/sda1    99M  13% ext3  rw   /boot
847
847
  /dev/sda2   540G  89% ext3  rw   /
848
848
  tmpfs        48G   0% tmpfs rw   /dev/shm
849
849
EOF
850
 
parse_filesystems "$samples/df-mount-003.txt" "Linux" > "$TMPDIR/got"
851
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "df-mount-003.txt Linux"
 
850
parse_filesystems "$samples/df-mount-003.txt" "Linux" > "$PT_TMPDIR/got"
 
851
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "df-mount-003.txt Linux"
852
852
 
853
 
cat <<EOF > $TMPDIR/expected
 
853
cat <<EOF > $PT_TMPDIR/expected
854
854
  Filesystem  Size Used Type        Opts              Mountpoint
855
855
  /dev/sda1   9.9G  34% ext3        rw                /
856
856
  /dev/sdb    414G   1% ext3        rw                /mnt
860
860
  none        7.6G   0% proc        rw                /dev/shm
861
861
  none        7.6G   0% sysfs       rw                /dev/shm
862
862
EOF
863
 
parse_filesystems "$samples/df-mount-004.txt" "Linux" > "$TMPDIR/got"
864
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "df-mount-004.txt Linux"
 
863
parse_filesystems "$samples/df-mount-004.txt" "Linux" > "$PT_TMPDIR/got"
 
864
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "df-mount-004.txt Linux"
865
865
 
866
 
cat <<EOF > $TMPDIR/expected
 
866
cat <<EOF > $PT_TMPDIR/expected
867
867
  Filesystem                         Size Used Type  Opts       Mountpoint
868
868
  /dev/cciss/c0d0p1                   99M  24% ext3  rw         /boot
869
869
  /dev/mapper/VolGroup00-LogVol00    194G  58% ext3  rw         /
871
871
  /dev/mapper/VolGroup01-mysql_data 1008G  44% ext3  rw,noatime /data/mysql-data
872
872
  tmpfs                               48G   0% tmpfs rw         /dev/shm
873
873
EOF
874
 
parse_filesystems "$samples/df-mount-005.txt" "Linux" > "$TMPDIR/got"
875
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "df-mount-005.txt Linux"
 
874
parse_filesystems "$samples/df-mount-005.txt" "Linux" > "$PT_TMPDIR/got"
 
875
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "df-mount-005.txt Linux"
876
876
 
877
 
cat <<EOF > $TMPDIR/expected
 
877
cat <<EOF > $PT_TMPDIR/expected
878
878
  Filesystem   Size Used Type  Opts                Mountpoint
879
879
  /dev/ad0s1a  496M  32% ufs   local               /
880
880
  /dev/ad0s1d  1.1G   1% ufs   local, soft-updates /var
882
882
  /dev/ad0s1f   17G   9% ufs   local, soft-updates /usr
883
883
  devfs        1.0K 100% devfs local               /dev
884
884
EOF
885
 
parse_filesystems "$samples/df-mount-006.txt" "FreeBSD" > "$TMPDIR/got"
886
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "df-mount-006.txt FreeBSD"
 
885
parse_filesystems "$samples/df-mount-006.txt" "FreeBSD" > "$PT_TMPDIR/got"
 
886
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "df-mount-006.txt FreeBSD"
887
887
 
888
888
# parse_ip_s_link
889
889
 
890
 
cat <<EOF > "$TMPDIR/expected"
 
890
cat <<EOF > "$PT_TMPDIR/expected"
891
891
  interface  rx_bytes rx_packets  rx_errors   tx_bytes tx_packets  tx_errors
892
892
  ========= ========= ========== ========== ========== ========== ==========
893
893
  lo          3000000      25000          0    3000000      25000          0
895
895
  wlan0      50000000      80000          0   20000000      90000          0
896
896
  vboxnet0          0          0          0          0          0          0
897
897
EOF
898
 
parse_ip_s_link "$samples/ip-s-link-001.txt" > $TMPDIR/got
899
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "ip-s-link-001.txt"
 
898
parse_ip_s_link "$samples/ip-s-link-001.txt" > $PT_TMPDIR/got
 
899
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "ip-s-link-001.txt"
900
900
 
901
 
cat <<EOF > "$TMPDIR/expected"
 
901
cat <<EOF > "$PT_TMPDIR/expected"
902
902
  interface  rx_bytes rx_packets  rx_errors   tx_bytes tx_packets  tx_errors
903
903
  ========= ========= ========== ========== ========== ========== ==========
904
904
  lo       3500000000  350000000          0 3500000000  350000000          0
906
906
  eth1     1250000000   60000000          0  900000000   50000000          0
907
907
  sit0              0          0          0          0          0          0
908
908
EOF
909
 
parse_ip_s_link "$samples/ip-s-link-002.txt" > "$TMPDIR/got"
910
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "ip-s-link-002.txt"
 
909
parse_ip_s_link "$samples/ip-s-link-002.txt" > "$PT_TMPDIR/got"
 
910
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "ip-s-link-002.txt"
911
911
 
912
 
cat <<EOF > "$TMPDIR/expected"
 
912
cat <<EOF > "$PT_TMPDIR/expected"
913
913
  interface  rx_bytes rx_packets  rx_errors   tx_bytes tx_packets  tx_errors
914
914
  ========= ========= ========== ========== ========== ========== ==========
915
915
  lo         25000000     300000          0   25000000     300000          0
917
917
  wlan0             0          0          0          0          0          0
918
918
  virbr0            0          0          0          0          0          0
919
919
EOF
920
 
parse_ip_s_link "$samples/ip-s-link-003.txt" > "$TMPDIR/got"
921
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "ip-s-link-003.txt"
 
920
parse_ip_s_link "$samples/ip-s-link-003.txt" > "$PT_TMPDIR/got"
 
921
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "ip-s-link-003.txt"
922
922
 
923
923
# parse_fdisk
924
924
 
925
 
cat <<EOF > "$TMPDIR/expected"
 
925
cat <<EOF > "$PT_TMPDIR/expected"
926
926
Device       Type      Start        End               Size
927
927
============ ==== ========== ========== ==================
928
928
/dev/dm-0    Disk                             494609104896
931
931
/dev/sda1    Part          1         26          205632000
932
932
/dev/sda2    Part         26      60801       499891392000
933
933
EOF
934
 
parse_fdisk "$samples/fdisk-01.txt" > "$TMPDIR/got"
935
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_fdisk"
 
934
parse_fdisk "$samples/fdisk-01.txt" > "$PT_TMPDIR/got"
 
935
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_fdisk"
936
936
 
937
937
# parse_ethernet_controller_lspci
938
938
 
939
 
cat <<EOF > $TMPDIR/expected
 
939
cat <<EOF > $PT_TMPDIR/expected
940
940
  Controller | Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet (rev 12)
941
941
  Controller | Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet (rev 12)
942
942
EOF
943
 
parse_ethernet_controller_lspci "$samples/lspci-001.txt" > "$TMPDIR/got"
944
 
no_diff "$TMPDIR/got" "$TMPDIR/expected"
 
943
parse_ethernet_controller_lspci "$samples/lspci-001.txt" > "$PT_TMPDIR/got"
 
944
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"
945
945
 
946
946
# parse_dmidecode_mem_devices
947
947
 
948
 
cat <<EOF > $TMPDIR/expected
 
948
cat <<EOF > $PT_TMPDIR/expected
949
949
  Locator   Size     Speed             Form Factor   Type          Type Detail
950
950
  ========= ======== ================= ============= ============= ===========
951
951
  SODIMM0   2048 MB  800 MHz           SODIMM        Other         Synchronous
952
952
  SODIMM1   2048 MB  800 MHz           SODIMM        Other         Synchronous
953
953
EOF
954
 
parse_dmidecode_mem_devices "$samples/dmidecode-001.txt" > $TMPDIR/got
955
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmidecode-001.tx"
 
954
parse_dmidecode_mem_devices "$samples/dmidecode-001.txt" > $PT_TMPDIR/got
 
955
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-001.tx"
956
956
 
957
 
cat <<EOF > "$TMPDIR/expected"
 
957
cat <<EOF > "$PT_TMPDIR/expected"
958
958
  Locator   Size     Speed             Form Factor   Type          Type Detail
959
959
  ========= ======== ================= ============= ============= ===========
960
960
  DIMM1     2048 MB  667 MHz (1.5 ns)  {OUT OF SPEC} {OUT OF SPEC} Synchronous
966
966
  DIMM7     2048 MB  667 MHz (1.5 ns)  {OUT OF SPEC} {OUT OF SPEC} Synchronous
967
967
  DIMM8     2048 MB  667 MHz (1.5 ns)  {OUT OF SPEC} {OUT OF SPEC} Synchronous
968
968
EOF
969
 
parse_dmidecode_mem_devices "$samples/dmidecode-002.txt" > "$TMPDIR/got"
970
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmidecode-002.tx"
 
969
parse_dmidecode_mem_devices "$samples/dmidecode-002.txt" > "$PT_TMPDIR/got"
 
970
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-002.tx"
971
971
 
972
 
cat <<EOF > "$TMPDIR/expected"
 
972
cat <<EOF > "$PT_TMPDIR/expected"
973
973
  Locator   Size     Speed             Form Factor   Type          Type Detail
974
974
  ========= ======== ================= ============= ============= ===========
975
975
            1024 kB  33 MHz            Other         Flash         Non-Volatile
992
992
  D7        {EMPTY}  1333 MHz          DIMM          Other         Other   
993
993
  D8        {EMPTY}  1333 MHz          DIMM          Other         Other   
994
994
EOF
995
 
parse_dmidecode_mem_devices "$samples/dmidecode-003.txt" > "$TMPDIR/got"
996
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmidecode-003.txt"
 
995
parse_dmidecode_mem_devices "$samples/dmidecode-003.txt" > "$PT_TMPDIR/got"
 
996
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-003.txt"
997
997
 
998
 
cat <<EOF > "$TMPDIR/expected"
 
998
cat <<EOF > "$PT_TMPDIR/expected"
999
999
  Locator   Size     Speed             Form Factor   Type          Type Detail
1000
1000
  ========= ======== ================= ============= ============= ===========
1001
1001
  DIMM_A2   4096 MB  1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Synchronous
1011
1011
  DIMM_B1   {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Synchronous
1012
1012
  DIMM_B4   {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Synchronous
1013
1013
EOF
1014
 
parse_dmidecode_mem_devices "$samples/dmidecode-004.txt" > "$TMPDIR/got"
1015
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmidecode-004.txt"
 
1014
parse_dmidecode_mem_devices "$samples/dmidecode-004.txt" > "$PT_TMPDIR/got"
 
1015
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-004.txt"
1016
1016
 
1017
 
cat <<EOF > "$TMPDIR/expected"
 
1017
cat <<EOF > "$PT_TMPDIR/expected"
1018
1018
  Locator   Size     Speed             Form Factor   Type          Type Detail
1019
1019
  ========= ======== ================= ============= ============= ===========
1020
1020
  P1-DIMM1A 16384 MB 1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Other   
1037
1037
  P2-DIMM3B {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
1038
1038
  P2-DIMM3C {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
1039
1039
EOF
1040
 
parse_dmidecode_mem_devices "$samples/dmidecode-005.txt" > "$TMPDIR/got"
1041
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmidecode-005.txt"
 
1040
parse_dmidecode_mem_devices "$samples/dmidecode-005.txt" > "$PT_TMPDIR/got"
 
1041
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-005.txt"
1042
1042
 
1043
1043
# parse_arcconf
1044
1044
 
1045
 
cat <<EOF > "$TMPDIR/expected"
 
1045
cat <<EOF > "$PT_TMPDIR/expected"
1046
1046
       Specs | Adaptec 3405, SAS/SATA, 128 MB cache, Optimal
1047
1047
     Battery | 99%, 3d1h11m remaining, Optimal
1048
1048
 
1058
1058
  Hard drive Online  SAS 3.0 Gb/s  SEAGATE ST3146855SS  140014 MB   On (WB)
1059
1059
EOF
1060
1060
 
1061
 
cat <<EOF > "$TMPDIR/in"
 
1061
cat <<EOF > "$PT_TMPDIR/in"
1062
1062
# /usr/StorMan/arcconf getconfig 1
1063
1063
Controllers found: 1
1064
1064
----------------------------------------------------------------------
1193
1193
Command completed successfully.
1194
1194
 
1195
1195
EOF
1196
 
parse_arcconf "$TMPDIR/in" > "$TMPDIR/got"
1197
 
no_diff "$TMPDIR/got" "$TMPDIR/expected"
 
1196
parse_arcconf "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
 
1197
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"
1198
1198
 
1199
 
cat <<EOF > "$TMPDIR/expected"
 
1199
cat <<EOF > "$PT_TMPDIR/expected"
1200
1200
       Specs | Adaptec 3405, SAS/SATA, 128 MB cache, Optimal
1201
1201
     Battery | 99%, 3d1h11m remaining, Optimal
1202
1202
 
1211
1211
  Hard drive Online  SAS 3.0 Gb/s  SEAGATE ST3300655SS  286102 MB   On (WB)
1212
1212
  Hard drive Online  SAS 3.0 Gb/s  SEAGATE ST3300655SS  286102 MB   On (WB)
1213
1213
EOF
1214
 
parse_arcconf "$samples/arcconf-002.txt" > "$TMPDIR/got"
1215
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "arcconf-002.txt"
 
1214
parse_arcconf "$samples/arcconf-002.txt" > "$PT_TMPDIR/got"
 
1215
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "arcconf-002.txt"
1216
1216
 
1217
1217
# Launchpad 917781, parse_arcconf doesn't work with ZMM
1218
1218
# https://bugs.launchpad.net/percona-toolkit/+bug/917781
1219
 
cat <<EOF > "$TMPDIR/expected"
 
1219
cat <<EOF > "$PT_TMPDIR/expected"
1220
1220
       Specs | Adaptec 5405Z, SAS/SATA, 512 MB cache, Optimal
1221
1221
     Battery | ZMM Optimal
1222
1222
 
1232
1232
  Hard drive Full rpm,Powered off SATA 3.0 Gb/s WDC     WD3000HLFS-0 286168 MB   On (WB)
1233
1233
EOF
1234
1234
 
1235
 
parse_arcconf "$samples/arcconf-004_917781.txt" > "$TMPDIR/got"
1236
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "Bug 917781"
 
1235
parse_arcconf "$samples/arcconf-004_917781.txt" > "$PT_TMPDIR/got"
 
1236
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Bug 917781"
1237
1237
 
1238
1238
# Launchpad 900285, ${var/ /} doesn't work in sh
1239
1239
# https://bugs.launchpad.net/percona-toolkit/+bug/900285
1240
 
cat <<EOF > "$TMPDIR/expected"
 
1240
cat <<EOF > "$PT_TMPDIR/expected"
1241
1241
       Specs | Adaptec 5805Z, SAS/SATA, 512 MB cache, Optimal
1242
1242
     Battery | ZMM Optimal
1243
1243
 
1255
1255
  Hard drive Full rpm,Powered off SAS 3.0 Gb/s  SEAGATE ST3300657SS  286102 MB   On (WB)
1256
1256
  Hard drive Full rpm,Powered off SAS 3.0 Gb/s  SEAGATE ST3300657SS  286102 MB   On (WB)
1257
1257
EOF
1258
 
parse_arcconf "$samples/arcconf-003_900285.txt" > "$TMPDIR/got"
1259
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "Bug 900285"
 
1258
parse_arcconf "$samples/arcconf-003_900285.txt" > "$PT_TMPDIR/got"
 
1259
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Bug 900285"
1260
1260
 
1261
1261
# parse_uptime
1262
1262
 
1263
 
cat <<EOF > "$TMPDIR/in"
 
1263
cat <<EOF > "$PT_TMPDIR/in"
1264
1264
 15:10:14 up 1 day, 15:08, 11 users,  load average: 0.18, 0.09, 0.08
1265
1265
EOF
1266
1266
is \
1267
 
   "$( parse_uptime "$TMPDIR/in" )" \
 
1267
   "$( parse_uptime "$PT_TMPDIR/in" )" \
1268
1268
   "1 day, 15:08, 11 users,  load average: 0.18, 0.09, 0.08" \
1269
1269
   "parse_uptime works with Ubuntu's uptime"
1270
1270
 
1271
 
cat <<EOF > "$TMPDIR/in"
 
1271
cat <<EOF > "$PT_TMPDIR/in"
1272
1272
 some weird format etc 1 day, 15:08, 11 users,  load average: 0.18, 0.09, 0.08
1273
1273
EOF
1274
1274
is \
1275
 
   "$( parse_uptime "$TMPDIR/in" )" \
 
1275
   "$( parse_uptime "$PT_TMPDIR/in" )" \
1276
1276
   " some weird format etc 1 day, 15:08, 11 users,  load average: 0.18, 0.09, 0.08" \
1277
1277
   "parse_uptime returns uptime as-if if it doesn't contain an 'up'"
1278
1278
 
1284
1284
   "format_lvs has a meaningful error message if all goes wrong"
1285
1285
 
1286
1286
 
1287
 
echo "Pretending to be an lvs dump" > "$TMPDIR/in"
 
1287
echo "Pretending to be an lvs dump" > "$PT_TMPDIR/in"
1288
1288
is \
1289
 
   "$(format_lvs "$TMPDIR/in" "")" \
 
1289
   "$(format_lvs "$PT_TMPDIR/in" "")" \
1290
1290
   "Pretending to be an lvs dump" \
1291
1291
   "format_lvs dumps the file passed in"
1292
1292
 
1293
1293
# report_system_summary
1294
1294
parse_options "$BIN_DIR/pt-summary"
1295
1295
 
1296
 
cat <<EOF > "$TMPDIR/expected"
 
1296
cat <<EOF > "$PT_TMPDIR/expected"
1297
1297
    Hostname | 
1298
1298
      Uptime | 57 mins, 1 user, load averages: 0.16, 0.03, 0.07
1299
1299
    Platform | FreeBSD
1345
1345
 0 0 0   58164  339792     0   0   0   0     0   0   0   0  231  115  229  0  5 95
1346
1346
# The End ####################################################
1347
1347
EOF
1348
 
report_system_summary "$samples/BSD/freebsd_001" | tail -n +3 > "$TMPDIR/got"
1349
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "report_system_summary works with samples from a FreeBSD box"
 
1348
report_system_summary "$samples/BSD/freebsd_001" | tail -n +3 > "$PT_TMPDIR/got"
 
1349
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "report_system_summary works with samples from a FreeBSD box"
1350
1350
 
1351
 
cat <<EOF > "$TMPDIR/expected"
 
1351
cat <<EOF > "$PT_TMPDIR/expected"
1352
1352
    Hostname | 
1353
1353
      Uptime | 43 mins, 2 users, load averages: 0.00, 0.00, 0.00
1354
1354
    Platform | NetBSD
1399
1399
 0 0 0  78564  21364    0   0   0    0    0    0  0  0  101   11  10  0 0 100
1400
1400
# The End ####################################################
1401
1401
EOF
1402
 
report_system_summary "$samples/BSD/netbsd_001" | tail -n +3 > "$TMPDIR/got"
1403
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "netbsd_001"
 
1402
report_system_summary "$samples/BSD/netbsd_001" | tail -n +3 > "$PT_TMPDIR/got"
 
1403
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "netbsd_001"
1404
1404
 
1405
 
cat <<EOF > "$TMPDIR/expected"
 
1405
cat <<EOF > "$PT_TMPDIR/expected"
1406
1406
    Hostname | openbsd.my.domain
1407
1407
      Uptime | 1:14, 1 user, load averages: 0.44, 0.20, 0.16
1408
1408
    Platform | OpenBSD
1451
1451
 0 0 0   7496  191456   11   0   0   0   0   0   0   0  230    23   12  0  0 100
1452
1452
# The End ####################################################
1453
1453
EOF
1454
 
report_system_summary "$samples/BSD/openbsd_001" | tail -n +3  > "$TMPDIR/got"
1455
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "openbsd_001"
 
1454
report_system_summary "$samples/BSD/openbsd_001" | tail -n +3  > "$PT_TMPDIR/got"
 
1455
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "openbsd_001"
1456
1456
 
1457
 
cat <<EOF > "$TMPDIR/expected"
 
1457
cat <<EOF > "$PT_TMPDIR/expected"
1458
1458
    Hostname | hugmeir
1459
1459
      Uptime | 1 day, 15:14,  5 users,  load average: 0.00, 0.06, 0.07
1460
1460
      System | Quanta; UW3; vTBD (Other)
1570
1570
# The End ####################################################
1571
1571
EOF
1572
1572
 
1573
 
report_system_summary "$samples/Linux/001" | tail -n +3 > "$TMPDIR/got"
1574
 
no_diff "$TMPDIR/got" "$TMPDIR/expected" "Linux/001 (Ubuntu)"
1575
 
 
1576
 
report_system_summary "$samples/Linux/002" | tail -n +3 > "$TMPDIR/got"
1577
 
no_diff "$TMPDIR/got" "$samples/Linux/output_002.txt" "Linux/002 (CentOS 5.7, as root)"
1578
 
 
1579
 
report_system_summary "$samples/Linux/003" | tail -n +3 > "$TMPDIR/got"
1580
 
no_diff "$TMPDIR/got" "$samples/Linux/output_003.txt" "Linux/003 (CentOS 5.7, as non-root)"
 
1573
report_system_summary "$samples/Linux/001" | tail -n +3 > "$PT_TMPDIR/got"
 
1574
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Linux/001 (Ubuntu)"
 
1575
 
 
1576
report_system_summary "$samples/Linux/002" | tail -n +3 > "$PT_TMPDIR/got"
 
1577
no_diff "$PT_TMPDIR/got" "$samples/Linux/output_002.txt" "Linux/002 (CentOS 5.7, as root)"
 
1578
 
 
1579
report_system_summary "$samples/Linux/003" | tail -n +3 > "$PT_TMPDIR/got"
 
1580
no_diff "$PT_TMPDIR/got" "$samples/Linux/output_003.txt" "Linux/003 (CentOS 5.7, as non-root)"