[2/2] fwts-test: Add regression test for HMAT

Submitted by Alex Hung on Aug. 3, 2017, 7:43 a.m.

Details

Message ID 1501746208-21930-2-git-send-email-alex.hung@canonical.com
State New
Headers show

Commit Message

Alex Hung Aug. 3, 2017, 7:43 a.m.
Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 Makefile.am                           |  2 +
 fwts-test/hmat-0001/acpidump-0001.log | 38 ++++++++++++++++++
 fwts-test/hmat-0001/acpidump-0002.log | 38 ++++++++++++++++++
 fwts-test/hmat-0001/hmat-0001.log     | 47 ++++++++++++++++++++++
 fwts-test/hmat-0001/hmat-0002.log     | 73 +++++++++++++++++++++++++++++++++++
 fwts-test/hmat-0001/test-0001.sh      | 23 +++++++++++
 fwts-test/hmat-0001/test-0002.sh      | 23 +++++++++++
 7 files changed, 244 insertions(+)
 create mode 100644 fwts-test/hmat-0001/acpidump-0001.log
 create mode 100644 fwts-test/hmat-0001/acpidump-0002.log
 create mode 100644 fwts-test/hmat-0001/hmat-0001.log
 create mode 100644 fwts-test/hmat-0001/hmat-0002.log
 create mode 100755 fwts-test/hmat-0001/test-0001.sh
 create mode 100755 fwts-test/hmat-0001/test-0002.sh

Patch hide | download patch | download mbox

diff --git a/Makefile.am b/Makefile.am
index f16de80..546dbcf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -96,6 +96,8 @@  TESTS = fwts-test/acpidump-0001/test-0001.sh \
 	fwts-test/fpdt-0001/test-0002.sh \
 	fwts-test/hest-0001/test-0001.sh \
 	fwts-test/hest-0001/test-0002.sh \
+	fwts-test/hmat-0001/test-0001.sh \
+	fwts-test/hmat-0001/test-0002.sh \
 	fwts-test/iort-0001/test-0001.sh \
 	fwts-test/iort-0001/test-0002.sh \
 	fwts-test/klog-0001/test-0001.sh \
diff --git a/fwts-test/hmat-0001/acpidump-0001.log b/fwts-test/hmat-0001/acpidump-0001.log
new file mode 100644
index 0000000..2d5c835
--- /dev/null
+++ b/fwts-test/hmat-0001/acpidump-0001.log
@@ -0,0 +1,38 @@ 
+FACS @ 0x00000000
+  0000: 46 41 43 53 40 00 00 00 00 00 00 00 00 00 00 00  FACS@...........
+  0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0020: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+
+FACP @ 0x00000000
+  0000: 46 41 43 50 f4 00 00 00 03 f9 41 4d 44 20 20 20  FACP......AMD   
+  0010: 47 55 41 4d 20 20 20 20 00 00 04 06 41 4d 44 20  GUAM    ....AMD 
+  0020: 40 42 0f 00 c0 2f e9 af 92 47 e8 af 00 02 09 00  @B.../...G......
+  0030: b0 00 00 00 f0 f1 00 00 00 80 00 00 00 00 00 00  ................
+  0040: 04 80 00 00 00 00 00 00 00 82 00 00 08 80 00 00  ................
+  0050: 20 80 00 00 00 00 00 00 04 02 01 04 08 00 00 00   ...............
+  0060: 65 00 e9 03 00 00 00 00 01 00 0d 00 32 00 00 00  e...........2...
+  0070: a5 c1 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0080: 00 00 00 00 c0 2f e9 af 00 00 00 00 92 47 e8 af  ...../.......G..
+  0090: 00 00 00 00 01 20 00 00 00 80 00 00 00 00 00 00  ..... ..........
+  00a0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00  ................
+  00b0: 04 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  00c0: 00 00 00 00 01 08 00 00 00 82 00 00 00 00 00 00  ................
+  00d0: 01 20 00 00 08 80 00 00 00 00 00 00 01 40 00 00  . ...........@..
+  00e0: 20 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ...............
+  00f0: 00 00 00 00                                      ....
+
+HMAT @ 0x0000000000000000
+  0000: 48 4d 41 54 b6 00 00 00 00 60 49 4e 54 45 4c 20  HMAT.....`INTEL 
+  0010: 54 45 4d 50 4c 41 54 45 00 00 00 00 49 4e 54 4c  TEMPLATE....INTL
+  0020: 29 06 17 20 00 00 00 00 00 00 00 00 28 00 00 00  ).. ........(...
+  0030: 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0050: 01 00 00 00 40 00 00 00 1f 05 00 00 02 00 00 00  ....@...........
+  0060: 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0080: 00 00 00 00 00 00 01 00 02 00 03 00 04 00 05 00  ................
+  0090: 02 00 00 00 26 00 00 00 00 00 00 00 00 00 00 00  ....&...........
+  00a0: 00 00 00 00 00 00 00 00 33 22 00 00 00 00 03 00  ........3"......
+  00b0: 00 00 01 00 02 00                                ......
diff --git a/fwts-test/hmat-0001/acpidump-0002.log b/fwts-test/hmat-0001/acpidump-0002.log
new file mode 100644
index 0000000..5464e81
--- /dev/null
+++ b/fwts-test/hmat-0001/acpidump-0002.log
@@ -0,0 +1,38 @@ 
+FACS @ 0x00000000
+  0000: 46 41 43 53 40 00 00 00 00 00 00 00 00 00 00 00  FACS@...........
+  0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0020: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+
+FACP @ 0x00000000
+  0000: 46 41 43 50 f4 00 00 00 03 f9 41 4d 44 20 20 20  FACP......AMD   
+  0010: 47 55 41 4d 20 20 20 20 00 00 04 06 41 4d 44 20  GUAM    ....AMD 
+  0020: 40 42 0f 00 c0 2f e9 af 92 47 e8 af 00 02 09 00  @B.../...G......
+  0030: b0 00 00 00 f0 f1 00 00 00 80 00 00 00 00 00 00  ................
+  0040: 04 80 00 00 00 00 00 00 00 82 00 00 08 80 00 00  ................
+  0050: 20 80 00 00 00 00 00 00 04 02 01 04 08 00 00 00   ...............
+  0060: 65 00 e9 03 00 00 00 00 01 00 0d 00 32 00 00 00  e...........2...
+  0070: a5 c1 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0080: 00 00 00 00 c0 2f e9 af 00 00 00 00 92 47 e8 af  ...../.......G..
+  0090: 00 00 00 00 01 20 00 00 00 80 00 00 00 00 00 00  ..... ..........
+  00a0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00  ................
+  00b0: 04 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  00c0: 00 00 00 00 01 08 00 00 00 82 00 00 00 00 00 00  ................
+  00d0: 01 20 00 00 08 80 00 00 00 00 00 00 01 40 00 00  . ...........@..
+  00e0: 20 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ...............
+  00f0: 00 00 00 00                                      ....
+
+HMAT @ 0x0000000000000000
+  0000: 48 4d 41 54 b6 00 00 00 00 36 49 4e 54 45 4c 20  HMAT.....6INTEL 
+  0010: 54 45 4d 50 4c 41 54 45 00 00 00 00 49 4e 54 4c  TEMPLATE....INTL
+  0020: 29 06 17 20 00 00 00 00 00 00 01 00 28 00 00 00  ).. ........(...
+  0030: 0f 00 02 00 00 00 00 00 00 00 00 00 03 00 00 00  ................
+  0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0050: 01 00 04 00 40 00 00 00 3f 06 05 00 02 00 00 00  ....@...?.......
+  0060: 03 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00  ................
+  0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0080: 00 00 00 00 00 00 01 00 02 00 03 00 04 00 05 00  ................
+  0090: 02 00 07 00 26 00 00 00 00 00 00 00 08 00 00 00  ....&...........
+  00a0: 00 00 00 00 00 00 00 00 33 23 00 00 09 00 03 00  ........3#......
+  00b0: 00 00 01 00 02 00                                ......
diff --git a/fwts-test/hmat-0001/hmat-0001.log b/fwts-test/hmat-0001/hmat-0001.log
new file mode 100644
index 0000000..d78484b
--- /dev/null
+++ b/fwts-test/hmat-0001/hmat-0001.log
@@ -0,0 +1,47 @@ 
+hmat            hmat: HMAT Heterogeneous Memory Attribute Table test.
+hmat            ----------------------------------------------------------
+hmat            Test 1 of 1: Validate HMAT table.
+hmat            HMAT Heterogeneous Memory Attribute Table:
+hmat              Reserved:        0x00
+hmat              Memory Subsystem Address Range (Type 0):
+hmat                Type:                           0x0000
+hmat                Reserved:                       0x0000
+hmat                Length:                         0x00000028
+hmat                Flags:                          0x0007
+hmat                Reserved:                       0x0000
+hmat                Processor Proximity Domain:     0x00000000
+hmat                Memory Proximity Domain:        0x00000000
+hmat                Reserved:                       0x00000000
+hmat                System Phy Addr Range Base:     0x0000000000000000
+hmat                System Phy Addr Range Length:   0x0000000000000000
+hmat            
+hmat              System Locality Latency and Bandwidth Information (Type 1):
+hmat                Type:                           0x0001
+hmat                Reserved:                       0x0000
+hmat                Length:                         0x00000040
+hmat                Flags:                          0x1f
+hmat                Data Type:                      0x05
+hmat                Reserved:                       0x0000
+hmat                Number of Initiator PDs:        0x00000002
+hmat                Number of Target PDs:           0x00000003
+hmat                Reserved:                       0x00000000
+hmat                Entry Base Unit:                0x0000000000000000
+hmat            
+hmat              Memory Side Cache Information (Type 2):
+hmat                Type:                           0x0002
+hmat                Reserved:                       0x0000
+hmat                Length:                         0x00000026
+hmat                Memory Proximity Domain:        0x00000000
+hmat                Reserved:                       0x00000000
+hmat                Memory Side Cache Size:         0x0000000000000000
+hmat                Cache Attributes:               0x00002233
+hmat                Reserved:                       0x0000
+hmat                Number of SMBIOS Handles:       0x0003
+hmat            
+hmat            
+hmat            PASSED: Test 1, No issues found in HMAT table.
+hmat            
+hmat            ==========================================================
+hmat            1 passed, 0 failed, 0 warning, 0 aborted, 0 skipped, 0
+hmat            info only.
+hmat            ==========================================================
diff --git a/fwts-test/hmat-0001/hmat-0002.log b/fwts-test/hmat-0001/hmat-0002.log
new file mode 100644
index 0000000..2394c28
--- /dev/null
+++ b/fwts-test/hmat-0001/hmat-0002.log
@@ -0,0 +1,73 @@ 
+hmat            hmat: HMAT Heterogeneous Memory Attribute Table test.
+hmat            ----------------------------------------------------------
+hmat            Test 1 of 1: Validate HMAT table.
+hmat            HMAT Heterogeneous Memory Attribute Table:
+hmat              Reserved:        0x00
+hmat              Memory Subsystem Address Range (Type 0):
+hmat                Type:                           0x0000
+hmat                Reserved:                       0x0001
+hmat                Length:                         0x00000028
+hmat                Flags:                          0x000f
+hmat                Reserved:                       0x0002
+hmat                Processor Proximity Domain:     0x00000000
+hmat                Memory Proximity Domain:        0x00000000
+hmat                Reserved:                       0x00000003
+hmat                System Phy Addr Range Base:     0x0000000000000000
+hmat                System Phy Addr Range Length:   0x0000000000000000
+hmat            FAILED [LOW] HMATReservedNonZero: Test 1, HMAT reserved
+hmat            field must be zero, got 0x0001 instead
+hmat            FAILED [HIGH] HMATBadFlags: Test 1, HMAT Flags's
+hmat            Bits[15..3] must be zero, got 0x000f instead
+hmat            FAILED [LOW] HMATReservedNonZero: Test 1, HMAT reserved
+hmat            field must be zero, got 0x0002 instead
+hmat            FAILED [LOW] HMATReservedNonZero: Test 1, HMAT reserved
+hmat            field must be zero, got 0x00000003 instead
+hmat            
+hmat              System Locality Latency and Bandwidth Information (Type 1):
+hmat                Type:                           0x0001
+hmat                Reserved:                       0x0004
+hmat                Length:                         0x00000040
+hmat                Flags:                          0x3f
+hmat                Data Type:                      0x06
+hmat                Reserved:                       0x0005
+hmat                Number of Initiator PDs:        0x00000002
+hmat                Number of Target PDs:           0x00000003
+hmat                Reserved:                       0x00000006
+hmat                Entry Base Unit:                0x0000000000000000
+hmat            FAILED [LOW] HMATReservedNonZero: Test 1, HMAT reserved
+hmat            field must be zero, got 0x0004 instead
+hmat            FAILED [CRITICAL] HMATBadFlags: Test 1, HMAT Flags's
+hmat            Bits[7..5] must be zero, got 0x3f instead
+hmat            FAILED [CRITICAL] HMATBadFDataType: Test 1, HMAT Data Type
+hmat            must be 0..5, got 0x06 instead
+hmat            FAILED [LOW] HMATReservedNonZero: Test 1, HMAT reserved
+hmat            field must be zero, got 0x0005 instead
+hmat            FAILED [LOW] HMATReservedNonZero: Test 1, HMAT reserved
+hmat            field must be zero, got 0x00000006 instead
+hmat            
+hmat              Memory Side Cache Information (Type 2):
+hmat                Type:                           0x0002
+hmat                Reserved:                       0x0007
+hmat                Length:                         0x00000026
+hmat                Memory Proximity Domain:        0x00000000
+hmat                Reserved:                       0x00000008
+hmat                Memory Side Cache Size:         0x0000000000000000
+hmat                Cache Attributes:               0x00002333
+hmat                Reserved:                       0x0009
+hmat                Number of SMBIOS Handles:       0x0003
+hmat            FAILED [LOW] HMATReservedNonZero: Test 1, HMAT reserved
+hmat            field must be zero, got 0x0007 instead
+hmat            FAILED [CRITICAL] HMATBadCacheAttributeReserved: Test 1,
+hmat            HMAT Cache Attribute reserved values are used, got
+hmat            0x00002333 instead
+hmat            FAILED [LOW] HMATReservedNonZero: Test 1, HMAT reserved
+hmat            field must be zero, got 0x00000008 instead
+hmat            FAILED [LOW] HMATReservedNonZero: Test 1, HMAT reserved
+hmat            field must be zero, got 0x0009 instead
+hmat            
+hmat            
+hmat            
+hmat            ==========================================================
+hmat            0 passed, 13 failed, 0 warning, 0 aborted, 0 skipped, 0
+hmat            info only.
+hmat            ==========================================================
diff --git a/fwts-test/hmat-0001/test-0001.sh b/fwts-test/hmat-0001/test-0001.sh
new file mode 100755
index 0000000..a64eb57
--- /dev/null
+++ b/fwts-test/hmat-0001/test-0001.sh
@@ -0,0 +1,23 @@ 
+#!/bin/bash
+#
+TEST="Test acpitables against HMAT"
+NAME=test-0001.sh
+TMPLOG=$TMP/hmat.log.$$
+
+$FWTS --show-tests | grep hmat > /dev/null
+if [ $? -eq 1 ]; then
+	echo SKIP: $TEST, $NAME
+	exit 77
+fi
+
+$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/hmat-0001/acpidump-0001.log hmat - | cut -c7- | grep "^hmat" > $TMPLOG
+diff $TMPLOG $FWTSTESTDIR/hmat-0001/hmat-0001.log >> $FAILURE_LOG
+ret=$?
+if [ $ret -eq 0 ]; then
+	echo PASSED: $TEST, $NAME
+else
+	echo FAILED: $TEST, $NAME
+fi
+
+rm $TMPLOG
+exit $ret
diff --git a/fwts-test/hmat-0001/test-0002.sh b/fwts-test/hmat-0001/test-0002.sh
new file mode 100755
index 0000000..7d15fb8
--- /dev/null
+++ b/fwts-test/hmat-0001/test-0002.sh
@@ -0,0 +1,23 @@ 
+#!/bin/bash
+#
+TEST="Test acpitables against invalid HMAT"
+NAME=test-0001.sh
+TMPLOG=$TMP/hmat.log.$$
+
+$FWTS --show-tests | grep hmat > /dev/null
+if [ $? -eq 1 ]; then
+	echo SKIP: $TEST, $NAME
+	exit 77
+fi
+
+$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/hmat-0001/acpidump-0002.log hmat - | cut -c7- | grep "^hmat" > $TMPLOG
+diff $TMPLOG $FWTSTESTDIR/hmat-0001/hmat-0002.log >> $FAILURE_LOG
+ret=$?
+if [ $ret -eq 0 ]; then
+	echo PASSED: $TEST, $NAME
+else
+	echo FAILED: $TEST, $NAME
+fi
+
+rm $TMPLOG
+exit $ret