Browse Source

(Almost) finish porting to JAT

The test body was not properly rewritten.  What still remains, though,
is that we don't have replacement for special RPMs.
Alois Mahdal 6 years ago
parent
commit
d6f0fa916f
1 changed files with 15 additions and 40 deletions
  1. 15
    40
      src/api/nativity/test

+ 15
- 40
src/api/nativity/test View File

1
 #!/bin/bash
1
 #!/bin/bash
2
-# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
3
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
-#
5
-#   runtest.sh of /CoreOS/preupgrade-assistant/api/nativity
6
-#   Description: package "nativity" functions
7
-#   Author: Alois Mahdal <amahdal@redhat.com>
8
-#
9
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10
-#
11
-#   Copyright (c) 2016 Red Hat, Inc.
12
-#
13
-#   This program is free software: you can redistribute it and/or
14
-#   modify it under the terms of the GNU General Public License as
15
-#   published by the Free Software Foundation, either version 2 of
16
-#   the License, or (at your option) any later version.
17
-#
18
-#   This program is distributed in the hope that it will be
19
-#   useful, but WITHOUT ANY WARRANTY; without even the implied
20
-#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
21
-#   PURPOSE.  See the GNU General Public License for more details.
22
-#
23
-#   You should have received a copy of the GNU General Public License
24
-#   along with this program. If not, see http://www.gnu.org/licenses/.
25
-#
26
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27
 
2
 
28
 shellfu import jat_dump
3
 shellfu import jat_dump
29
 shellfu import preupg
4
 shellfu import preupg
53
     local pkg=$1
28
     local pkg=$1
54
     case $Fn in
29
     case $Fn in
55
         get_dist_native_list)
30
         get_dist_native_list)
56
-            rlRun "grep '$pkg' r_native" \
57
-                1 "package $pkg not considered native"
31
+            jat__cmd -h "package $pkg not considered native" \
32
+                -S 1 \
33
+                grep "$pkg" r_native
58
             ;;
34
             ;;
59
         is_dist_native)
35
         is_dist_native)
60
-            rlAssertNotEquals \
61
-                "package $pkg not considered native" \
62
-                "$(cat r_es)" 0
36
+            jat__cmp -h "package $pkg not considered native" \
37
+                "$(cat r_es)" eq 0
63
             ;;
38
             ;;
64
     esac
39
     esac
65
 }
40
 }
71
     local pkg=$1
46
     local pkg=$1
72
     case $Fn in
47
     case $Fn in
73
         get_dist_native_list)
48
         get_dist_native_list)
74
-            rlRun "grep '$pkg' r_native" \
75
-                0 "package $pkg considered native"
49
+            jat__cmd -h "package $pkg considered native" \
50
+                grep "$pkg" r_native
76
             ;;
51
             ;;
77
         is_dist_native)
52
         is_dist_native)
78
-            rlAssertEquals \
79
-                "package $pkg considered native" \
80
-                "$(cat r_es)" 0
53
+            jat__cmp -h "package $pkg considered native" \
54
+                "$(cat r_es)" eq 0
81
             ;;
55
             ;;
82
     esac
56
     esac
83
 }
57
 }
192
     # ensure package (non-)presence)
166
     # ensure package (non-)presence)
193
     #
167
     #
194
     case $Check in
168
     case $Check in
195
-        foreign)    rlAssertRpm "$FOREIGN"  ;;
196
-        native)     rlAssertRpm "$NATIVE"   ;;
197
-        ninst)      rlAssertNotRpm "$NINST" ;;
169
+        foreign)    jat__cmd rpm -q "$FOREIGN"  ;;
170
+        native)     jat__cmd rpm -q "$NATIVE"   ;;
171
+        ninst)      jat__cmd -S 1 rpm -q "$NINST" ;;
198
     esac
172
     esac
199
 
173
 
200
     # collect data
174
     # collect data
228
     # do the test
202
     # do the test
229
     #
203
     #
230
     case $Check in
204
     case $Check in
231
-        diff)       rlRun "diff -U 1 o_native r_native > r_diff" \
232
-                        0 "native list is same as expected" \
205
+        diff)       jat__cmd -h "native list is same as expected" \
206
+                        -o r_diff \
207
+                        diff -U 1 o_native r_native \
233
                      || jat_dump__file -E r_diff ;;
208
                      || jat_dump__file -E r_diff ;;
234
         native)     assert_native  "$NATIVE"     ;;
209
         native)     assert_native  "$NATIVE"     ;;
235
         excluded)   assert_foreign "$EXCLUDED"   ;;
210
         excluded)   assert_foreign "$EXCLUDED"   ;;