Merge ~alextu/plainbox-provider-pc-sanity:bats-in-jemmy into plainbox-provider-pc-sanity:master

Proposed by Alex Tu
Status: Merged
Approved by: Kai-Chuan Hsieh
Approved revision: ef3142a7c36d512444ca86016ce26081d6d8e4fa
Merged at revision: 6652f44e3d32d789ed5164424fc5018e535899e3
Proposed branch: ~alextu/plainbox-provider-pc-sanity:bats-in-jemmy
Merge into: plainbox-provider-pc-sanity:master
Diff against target: 243 lines (+110/-102)
2 files modified
bin/platform_meta_test (+1/-1)
test/platform_meta_test.bats (+109/-101)
Reviewer Review Type Date Requested Status
Kai-Chuan Hsieh Approve
OEM Solutions Group: Engineers Pending
Review via email: mp+418940@code.launchpad.net
To post a comment you must log in.
Revision history for this message
OEM Taipei Bot (oem-taipei-bot) wrote :
Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/bin/platform_meta_test b/bin/platform_meta_test
index deacc30..2d7818a 100755
--- a/bin/platform_meta_test
+++ b/bin/platform_meta_test
@@ -111,7 +111,7 @@ check_somerville_meta() {
111 fi111 fi
112 done112 done
113 ;;113 ;;
114 ('focal')114 ('focal' | 'jammy')
115 for meta in $(ubuntu-drivers list | grep "^oem" | grep "meta$"); do115 for meta in $(ubuntu-drivers list | grep "^oem" | grep "meta$"); do
116 if apt-cache show "$meta" | grep ^Modaliases | grep -i "sv00001028sd0000$BIOSID" > /dev/null 2>&1; then116 if apt-cache show "$meta" | grep ^Modaliases | grep -i "sv00001028sd0000$BIOSID" > /dev/null 2>&1; then
117 if dpkg-query -W -f='${Status}\n' "$meta" 2>&1 | grep "install ok installed" >/dev/null 2>&1; then117 if dpkg-query -W -f='${Status}\n' "$meta" 2>&1 | grep "install ok installed" >/dev/null 2>&1; then
diff --git a/test/platform_meta_test.bats b/test/platform_meta_test.bats
index c9f9c61..1ae5e75 100644
--- a/test/platform_meta_test.bats
+++ b/test/platform_meta_test.bats
@@ -12,116 +12,124 @@ function ubuntu-drivers() {
12 echo "$ubuntu_drivers_string"12 echo "$ubuntu_drivers_string"
13}13}
1414
15@test "somerville in focal : Pass if meta package installed" {15function lsb_release() {
16 echo "$ubuntu_codename"
17}
18
19@test "somerville in focal/jammy : Pass if meta package installed" {
16 set -e20 set -e
17 ubuntu_codename='focal'21 for ubuntu_codename in 'focal' 'jammy'; do
18 BIOSID='08AF'22 BIOSID='08AF'
19 ubuntu_drivers_string="oem-somerville-beric-icl-meta"23 ubuntu_drivers_string="oem-somerville-beric-icl-meta"
20 function dpkg() {24 function dpkg() {
21 echo "$dpkg_string"25 echo "$dpkg_string"
22 }26 }
23 function apt-cache() {27 function apt-cache() {
24 echo "Modaliases: meta(pci:*sv00001028sd0000$BIOSID*)"28 echo "Modaliases: meta(pci:*sv00001028sd0000$BIOSID*)"
25 }29 }
26 function dpkg-query() {30 function dpkg-query() {
27 opts="$@"31 opts="$@"
28 if [ -z ${opts##*oem-somerville-beric-icl-meta*} ]; then32 if [ -z ${opts##*oem-somerville-beric-icl-meta*} ]; then
29 echo "install ok installed"33 echo "install ok installed"
30 elif [ -z ${opts##*oem-somerville-factory-beric-icl-meta*} ];then34 elif [ -z ${opts##*oem-somerville-factory-beric-icl-meta*} ];then
31 echo "install ok installed"35 echo "install ok installed"
32 fi36 fi
33 }37 }
34 dpkg_string="38 dpkg_string="
35 ii oem-somerville-beric-icl-meta 20.04ubuntu3.1 all hardware support for Somerville beric-icl platform39 ii oem-somerville-beric-icl-meta 20.04ubuntu3.1 all hardware support for Somerville beric-icl platform
36 ii oem-somerville-factory-beric-icl-meta 20.04ubuntu3.1 all hardware support for Somerville beric-icl platform40 ii oem-somerville-factory-beric-icl-meta 20.04ubuntu3.1 all hardware support for Somerville beric-icl platform
37 "41 "
38 run check_somerville_meta42 run check_somerville_meta
39 [ "$status" -eq 0 ]43 [ "$status" -eq 0 ]
44 done
40}45}
4146
42@test "somerville in focal : Error if meta package in remove candidate state" {47@test "somerville in focal/jammy : Error if meta package in remove candidate state" {
43 set -e48 set -e
44 ubuntu_codename='focal'49 for ubuntu_codename in 'focal' 'jammy'; do
45 BIOSID='08AF'50 BIOSID='08AF'
46 ubuntu_drivers_string="oem-somerville-beric-icl-meta"51 ubuntu_drivers_string="oem-somerville-beric-icl-meta"
47 function dpkg() {52 function dpkg() {
48 echo "$dpkg_string"53 echo "$dpkg_string"
49 }54 }
50 function apt-cache() {55 function apt-cache() {
51 echo "Modaliases: meta(pci:*sv00001028sd0000$BIOSID*)"56 echo "Modaliases: meta(pci:*sv00001028sd0000$BIOSID*)"
52 }57 }
53 function dpkg-query() {58 function dpkg-query() {
54 # the message when `dpkg-query -W -f='${Status}\n' "$package_in_rc_state"`59 # the message when `dpkg-query -W -f='${Status}\n' "$package_in_rc_state"`
55 opts="$@"60 opts="$@"
56 if [ -z ${opts##*oem-somerville-beric-icl-meta*} ]; then61 if [ -z ${opts##*oem-somerville-beric-icl-meta*} ]; then
57 echo "deinstall ok config-files"62 echo "deinstall ok config-files"
58 elif [ -z ${opts##*oem-somerville-factory-beric-icl-meta*} ];then63 elif [ -z ${opts##*oem-somerville-factory-beric-icl-meta*} ];then
59 echo "deinstall ok config-files"64 echo "deinstall ok config-files"
60 fi65 fi
61 }66 }
62 dpkg_string="67 dpkg_string="
63 ii oem-somerville-beric-icl-meta 20.04ubuntu3.1 all hardware support for Somerville Bulbasaur platform68 ii oem-somerville-beric-icl-meta 20.04ubuntu3.1 all hardware support for Somerville Bulbasaur platform
64 "69 "
65 run check_somerville_meta70 run check_somerville_meta
66 [ "$status" -eq 1 ]71 [ "$status" -eq 1 ]
72 done
67}73}
6874
69# For the case that meta package not installed.75# For the case that meta package not installed.
70@test "somerville in focal : Error if meta package Not installed" {76@test "somerville in focal/jammy : Error if meta package Not installed" {
71 set -e77 set -e
72 ubuntu_codename='focal'78 for ubuntu_codename in 'focal' 'jammy'; do
73 BIOSID='08AF'79 BIOSID='08AF'
74 ubuntu_driers_string="oem-somerville-beric-icl-meta"80 ubuntu_drivers_string="oem-somerville-beric-icl-meta"
75 function dpkg() {81 function dpkg() {
76 echo "$dpkg_string"82 echo "$dpkg_string"
77 }83 }
78 function apt-cache() {84 function apt-cache() {
79 echo "Modaliases: meta(pci:*sv00001028sd0000$BIOSID*)"85 echo "Modaliases: meta(pci:*sv00001028sd0000$BIOSID*)"
80 }86 }
81 function dpkg-query() {87 function dpkg-query() {
82 opts="$@"88 opts="$@"
83 if [ -z ${opts##*oem-somerville-beric-icl-meta*} ]; then89 if [ -z ${opts##*oem-somerville-beric-icl-meta*} ]; then
84 # the message when `dpkg-query -W -f='${Status}\n' "$package_not_installed"`90 # the message when `dpkg-query -W -f='${Status}\n' "$package_not_installed"`
85 echo "dpkg-query: no packages found matching "91 echo "dpkg-query: no packages found matching "
86 elif [ -z ${opts##*oem-somerville-factory-beric-icl-meta*} ];then92 elif [ -z ${opts##*oem-somerville-factory-beric-icl-meta*} ];then
87 echo "dpkg-query: no packages found matching "93 echo "dpkg-query: no packages found matching "
88 fi94 fi
89 }95 }
90 dpkg_string="96 dpkg_string="
91 ii oem-ouagadougou-meta 1.0~20.04ouagadougou4 all Meta package for the OEM mainstreams image.97 ii oem-ouagadougou-meta 1.0~20.04ouagadougou4 all Meta package for the OEM mainstreams image.
92 ii oem-somerville-factory-meta 20.04ubuntu9 all hardware support for Somerville platform98 ii oem-somerville-factory-meta 20.04ubuntu9 all hardware support for Somerville platform
93 ii oem-somerville-meta 20.04ubuntu9 all hardware support for Somerville platform99 ii oem-somerville-meta 20.04ubuntu9 all hardware support for Somerville platform
94 ii python3-importlib-metadata 1.5.0-1 all library to access the metadata for a Python package - Python 3.x100 ii python3-importlib-metadata 1.5.0-1 all library to access the metadata for a Python package - Python 3.x
95 "101 "
96 run check_somerville_meta102 run check_somerville_meta
97 [ "$status" -eq 1 ]103 [ "$status" -eq 1 ]
104 done
98}105}
99106
100@test "somerville in focal : Error if factory meta package Not installed" {107@test "somerville in focal/jammy : Error if factory meta package Not installed" {
101 set -e108 set -e
102 ubuntu_codename='focal'109 for ubuntu_codename in 'focal' 'jammy'; do
103 BIOSID='08AF'110 BIOSID='08AF'
104 ubuntu_driers_string="oem-somerville-beric-icl-meta"111 ubuntu_drivers_string="oem-somerville-beric-icl-meta"
105 function dpkg() {112 function dpkg() {
106 echo "$dpkg_string"113 echo "$dpkg_string"
107 }114 }
108 function apt-cache() {115 function apt-cache() {
109 echo "Modaliases: meta(pci:*sv00001028sd0000$BIOSID*)"116 echo "Modaliases: meta(pci:*sv00001028sd0000$BIOSID*)"
110 }117 }
111 function dpkg-query() {118 function dpkg-query() {
112 opts="$@"119 opts="$@"
113 if [ -z ${opts##*oem-somerville-beric-icl-meta*} ]; then120 if [ -z ${opts##*oem-somerville-beric-icl-meta*} ]; then
114 echo "install ok installed"121 echo "install ok installed"
115 elif [ -z ${opts##*oem-somerville-factory-beric-icl-meta*} ];then122 elif [ -z ${opts##*oem-somerville-factory-beric-icl-meta*} ];then
116 echo "dpkg-query: no packages found matching "123 echo "dpkg-query: no packages found matching "
117 fi124 fi
118 }125 }
119 dpkg_string="126 dpkg_string="
120 ii oem-ouagadougou-meta 1.0~20.04ouagadougou4 all Meta package for the OEM mainstreams image.127 ii oem-ouagadougou-meta 1.0~20.04ouagadougou4 all Meta package for the OEM mainstreams image.
121 ii oem-somerville-factory-meta 20.04ubuntu9 all hardware support for Somerville platform128 ii oem-somerville-factory-meta 20.04ubuntu9 all hardware support for Somerville platform
122 ii oem-somerville-meta 20.04ubuntu9 all hardware support for Somerville platform129 ii oem-somerville-meta 20.04ubuntu9 all hardware support for Somerville platform
123 ii python3-importlib-metadata 1.5.0-1 all library to access the metadata for a Python package - Python 3.x130 ii python3-importlib-metadata 1.5.0-1 all library to access the metadata for a Python package - Python 3.x
124 "131 "
125 run check_somerville_meta132 run check_somerville_meta
126 [ "$status" -eq 1 ]133 [ "$status" -eq 1 ]
134 done
127}135}

Subscribers

People subscribed via source and target branches