Merge ~alextu/plainbox-provider-pc-sanity:pick-oem-meta-test-from-QA-plan into plainbox-provider-pc-sanity:master

Proposed by Alex Tu
Status: Merged
Merged at revision: eaab1518c4751513af40ac9a1f7f607ac4b30a7e
Proposed branch: ~alextu/plainbox-provider-pc-sanity:pick-oem-meta-test-from-QA-plan
Merge into: plainbox-provider-pc-sanity:master
Diff against target: 109 lines (+84/-0)
3 files modified
bin/platform_meta_test (+76/-0)
units/pc-sanity/pc-sanity-check-env.pxu (+7/-0)
units/pc-sanity/pc-sanity.pxu (+1/-0)
Reviewer Review Type Date Requested Status
Shih-Yuan Lee Approve
StanleyHuang Pending
OEM Solutions Group: Engineers Pending
Review via email: mp+395557@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alex Tu (alextu) wrote :

another pick-up from QA test plan for oem meta package.
After this MP be merged, QA test plan can just nest to this job.

Revision history for this message
Shih-Yuan Lee (fourdollars) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/platform_meta_test b/bin/platform_meta_test
2new file mode 100755
3index 0000000..1e1424c
4--- /dev/null
5+++ b/bin/platform_meta_test
6@@ -0,0 +1,76 @@
7+#!/bin/bash
8+# For somerville xenial-osp1 and after, there are two meta packages should be installed
9+# 1. Platform meta pacakge: PLATFORM_NAME-meta, e.g. turis-vegas-mlk-glk-meta
10+# 2. BIOS ID meta package: dell-BIOS_ID-RELEASE-meta or dell-BIOS_ID-meta.
11+# e.g. dell-086b-bionic-meta
12+# From somerville bionic-osp1 and after, the BIOS ID package is deprecated and replaced
13+# by modaliases in platform meta package.
14+# 1. Platform meta pacakge: oem-PLATFORM_NAME-meta, e.g. oem-beaver-osp1-worm-meta
15+# 2. BIOS ID modaliases in platform meta package:
16+# e.g. Modaliases: hwe(pci:*sv00001028sd0000096E*, pci:*sv00001028sd0000096F*)
17+
18+echo "Beginning Platform Metapackage Test" 1>&2
19+
20+failed()
21+{
22+ [ -n "$1" ] && echo "$1"
23+ echo "$0 failed!"
24+ exit 1
25+}
26+
27+passed()
28+{
29+ [ -n "$1" ] && echo "$1"
30+ echo "$0 passed!"
31+ exit 0
32+}
33+
34+platform_tag=$(ubuntu-report show | grep DCD | awk -F'+' '{print $2}')
35+[ -n "${platform_tag}" ] || failed "no platform tag in ubuntu-report"
36+
37+BIOSID=$(cat /sys/devices/virtual/dmi/id/product_sku)
38+codename=$(lsb_release -cs)
39+
40+case "$codename" in
41+ ('xenial')
42+ for meta in $(dpkg -l | grep ".*-meta" | awk '{print ($2)}'); do
43+ if [[ "$meta" =~ ^dell-$BIOSID(-${codename})?-meta$ ]];then
44+ pmeta=$(apt-cache depends "$meta" | grep Depends | awk '{print ($2)}' | grep -o ".*-meta")
45+ passed "Found platform meta packages: $pmeta, $meta"
46+ fi
47+ done
48+ ;;
49+ ('bionic')
50+ for meta in $(dpkg -l | grep ".*-meta" | awk '{print ($2)}'); do
51+ if [[ "$meta" =~ ^dell-$BIOSID(-${codename})?-meta$ ]];then
52+ pmeta=$(apt-cache depends "$meta" | grep Depends | awk '{print ($2)}' | grep -o ".*-meta")
53+ passed "Found platform meta packages: $pmeta, $meta"
54+ fi
55+ done
56+ dpkg -l "${platform_tag}-meta" > /dev/null 2>&1 && passed "Found platform meta package: ${platform_tag}-meta"
57+ pmeta="oem-${platform_tag}-meta"
58+ dpkg -l "$pmeta" > /dev/null 2>&1 && apt-cache show "$pmeta" | grep ^Modaliases | grep -i "sv00001028sd0000$BIOSID" && passed "Found platform meta package '$pmeta' containing BIOS ID '$BIOSID'"
59+ for pmeta in $(ubuntu-drivers list | grep "^oem" | grep "meta$"); do
60+ if apt-cache show "$pmeta" | grep ^Modaliases | grep -i "sv00001028sd0000$BIOSID" > /dev/null 2>&1; then
61+ passed "Found platform meta package '$pmeta' containing BIOS ID '$BIOSID'"
62+ fi
63+ done
64+ ;;
65+ ('focal')
66+ for meta in $(ubuntu-drivers list | grep "^oem" | grep "meta$"); do
67+ if apt-cache show "$meta" | grep ^Modaliases | grep -i "sv00001028sd0000$BIOSID" > /dev/null 2>&1; then
68+ if dpkg-query -W -f='${Status}\n' "$meta" 2>&1 | grep "install ok installed" >/dev/null 2>&1; then
69+ factory="${meta/oem-somerville/oem-somerville-factory}"
70+ if dpkg-query -W -f='${Status}\n' "$factory" 2>&1 | grep "install ok installed" >/dev/null 2>&1; then
71+ passed "Found the platform meta package '$meta' containing BIOS ID '$BIOSID' and the platform factory meta package '$factory'"
72+ fi
73+ fi
74+ fi
75+ done
76+ ;;
77+ (*)
78+ failed "$codename is not supported yet."
79+ ;;
80+esac
81+
82+failed "Platform Tag: $platform_tag, BIOS ID: $BIOSID"
83diff --git a/units/pc-sanity/pc-sanity-check-env.pxu b/units/pc-sanity/pc-sanity-check-env.pxu
84index fec17c8..feaced1 100644
85--- a/units/pc-sanity/pc-sanity-check-env.pxu
86+++ b/units/pc-sanity/pc-sanity-check-env.pxu
87@@ -1,3 +1,10 @@
88+id: somerville/platform-meta-test
89+category_id: somerville
90+plugin: shell
91+command:
92+ platform_meta_test
93+_description: Check if the platform metapackage is installed.
94+
95 plugin: shell
96 category_id: com.canonical.plainbox::miscellanea
97 id: miscellanea/gate_rste_raid
98diff --git a/units/pc-sanity/pc-sanity.pxu b/units/pc-sanity/pc-sanity.pxu
99index b500151..79c11d0 100644
100--- a/units/pc-sanity/pc-sanity.pxu
101+++ b/units/pc-sanity/pc-sanity.pxu
102@@ -5,6 +5,7 @@ _description:
103 This test plan is for smoke test as sanity before release image.
104 include:
105 com.canonical.certification::somerville-installation
106+ com.canonical.certification::somerville/platform-meta-test
107 com.canonical.certification::misc/generic/grub_boothole
108 com.canonical.certification::miscellanea/check-nvidia
109 com.canonical.certification::miscellanea/debsums

Subscribers

People subscribed via source and target branches