@@ -30,21 +30,12 @@ def first_boot [] {
3030 RUN echo 'large-file-marker' | dd of=/usr/share/large-test-file conv=notrunc
3131 " | podman build - t localhost/bootc-derived . - f -
3232
33- let current_time = (date now )
34-
3533 bootc switch -- transport containers-storage localhost/bootc-derived
3634
3735 # Find the large file's verity and save it
38- # nu has its own built in find which sucks, so we use the other one
39- # TODO: Replace this with some concrete API
40- # See: https://github.com/composefs/composefs-rs/pull/236
41- let file_path = (
42- /usr/bin/find /sysroot/composefs/objects -type f - size 1337k - newermt ($current_time | format date " %Y-%m-%d %H:%M:%S" )
43- | xargs grep - lx " large-file-marker"
44- )
45-
46- echo $file_path | save /var/large-file-marker-objpath
47- cat /var/large-file-marker-objpath
36+ let new_st = bootc status -- json | from json
37+ let path = bootc internals cfs dump-files $new_st.status.staged.composefs.verity /usr/share/large-test-file -- backing-path-only | awk ' {print $2}'
38+ echo $" /sysroot/composefs/objects/($path )" | save /var/large-file-marker-objpath
4839
4940 echo $st.status.booted.composefs.verity | save /var/first-verity
5041
@@ -123,22 +114,6 @@ def third_boot [] {
123114 echo "
124115 FROM localhost/bootc-derived-initrd
125116 RUN echo 'another file' > /usr/share/another-one
126- " | podman build - t localhost/bootc-prefinal . - f -
127-
128-
129- bootc switch -- transport containers-storage localhost/bootc-prefinal
130-
131- tmt-reboot
132- }
133-
134- def fourth_boot [] {
135- assert equal $booted.image.image " localhost/bootc-prefinal"
136-
137- # Now we create a new image derived from the current kernel + initrd
138- # Switching to this and rebooting should remove the old kernel + initrd
139- echo "
140- FROM localhost/bootc-derived-initrd
141- RUN echo 'another file 1' > /usr/share/another-one-1
142117 " | podman build - t localhost/bootc-final . - f -
143118
144119
@@ -147,7 +122,7 @@ def fourth_boot [] {
147122 tmt-reboot
148123}
149124
150- def fifth_boot [] {
125+ def fourth_boot [] {
151126 let bootloader = (bootc status -- json | from json ).status.booted.composefs.bootloader
152127
153128 if ($bootloader | str downcase ) == " systemd" {
@@ -156,10 +131,6 @@ def fifth_boot [] {
156131 mount /dev/disk/by-partlabel/EFI-SYSTEM /var/tmp/efi
157132 }
158133
159- # The large file should be GC'd in the previous switch
160- let path = cat /var/large-file-marker-objpath
161- assert (not ($path | path exists ))
162-
163134 assert equal $booted.image.image " localhost/bootc-final"
164135 assert (not ((cat /var/to-be-deleted-kernel | path exists )))
165136
@@ -174,10 +145,14 @@ def fifth_boot [] {
174145
175146 bootc switch -- transport containers-storage localhost/bootc-shared-1
176147
148+ # The large file should be GC'd in the previous switch
149+ let path = cat /var/large-file-marker-objpath
150+ assert (not ($path | path exists ))
151+
177152 tmt-reboot
178153}
179154
180- def sixth_boot [i : int ] {
155+ def fifth_boot [i : int ] {
181156 assert equal $booted.image.image $" localhost/bootc-shared-($i )"
182157
183158 # Just this being booted counts as success
@@ -201,10 +176,9 @@ def main [] {
201176 " 1" => second_boot ,
202177 " 2" => third_boot ,
203178 " 3" => fourth_boot ,
204- " 4" => fifth_boot ,
205- " 5" => { sixth_boot 1 },
206- " 6" => { sixth_boot 2 },
207- " 7" => { sixth_boot 3 },
179+ " 4" => { fifth_boot 1 },
180+ " 5" => { fifth_boot 2 },
181+ " 6" => { fifth_boot 3 },
208182 $o => { error make { msg : $" Invalid TMT_REBOOT_COUNT ($o )" } },
209183 }
210184}
0 commit comments