TheChymera / mkstage4

Bash Utility for Creating Stage 4 Tarballs
GNU General Public License v3.0
104 stars 22 forks source link

Test phase for ebuild #38

Closed TheChymera closed 1 year ago

TheChymera commented 4 years ago

@lucianposton I want to bump the ebuild for mkstage4 to include the features which you contributed. Sadly, the bats test suite does not pass in the preliminary ebuild:

silenthost ~ # FEATURES=test emerge -av mkstage4

 * IMPORTANT: 5 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] app-backup/mkstage4-0.3::chymeric  USE="test%*" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

Would you like to merge these packages? [Yes/No] y

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) app-backup/mkstage4-0.3::chymeric
 * mkstage4-0.3.tar.gz SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                          [ ok ]
>>> Unpacking source...
>>> Unpacking mkstage4-0.3.tar.gz to /var/tmp/portage/app-backup/mkstage4-0.3/work
>>> Source unpacked in /var/tmp/portage/app-backup/mkstage4-0.3/work
>>> Preparing source in /var/tmp/portage/app-backup/mkstage4-0.3/work/mkstage4-0.3 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-backup/mkstage4-0.3/work/mkstage4-0.3 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/app-backup/mkstage4-0.3/work/mkstage4-0.3 ...
>>> Source compiled.
>>> Test phase: app-backup/mkstage4-0.3
Bats 0.4.0
Usage: bats [-c] [-p | -t] <test> [<test> ...]
 * ERROR: app-backup/mkstage4-0.3::chymeric failed (test phase):
 *   (no error message)
 *
 * Call stack:
 *     ebuild.sh, line 125:  Called src_test
 *   environment, line 354:  Called die
 * The specific snippet of code:
 *       bats -r tests || die
 *
 * If you need support, post the output of `emerge --info '=app-backup/mkstage4-0.3::chymeric'`,
 * the complete build log and the output of `emerge -pqv '=app-backup/mkstage4-0.3::chymeric'`.
 * The complete build log is located at '/var/tmp/portage/app-backup/mkstage4-0.3/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-backup/mkstage4-0.3/temp/environment'.
 * Working directory: '/var/tmp/portage/app-backup/mkstage4-0.3/work/mkstage4-0.3'
 * S: '/var/tmp/portage/app-backup/mkstage4-0.3/work/mkstage4-0.3'

>>> Failed to emerge app-backup/mkstage4-0.3, Log file:

>>>  '/var/tmp/portage/app-backup/mkstage4-0.3/temp/build.log'

 * Messages for package app-backup/mkstage4-0.3:

 * ERROR: app-backup/mkstage4-0.3::chymeric failed (test phase):
 *   (no error message)
 *
 * Call stack:
 *     ebuild.sh, line 125:  Called src_test
 *   environment, line 354:  Called die
 * The specific snippet of code:
 *       bats -r tests || die
 *
 * If you need support, post the output of `emerge --info '=app-backup/mkstage4-0.3::chymeric'`,
 * the complete build log and the output of `emerge -pqv '=app-backup/mkstage4-0.3::chymeric'`.
 * The complete build log is located at '/var/tmp/portage/app-backup/mkstage4-0.3/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-backup/mkstage4-0.3/temp/environment'.
 * Working directory: '/var/tmp/portage/app-backup/mkstage4-0.3/work/mkstage4-0.3'
 * S: '/var/tmp/portage/app-backup/mkstage4-0.3/work/mkstage4-0.3'

Any idea what's going on?

lucianposton commented 4 years ago
 INSERT  …  didactic-duck  app-backup  mkstage4   test-ebuild \=mkstage4-0.3                                                                                                   master 
 * WARNING: The FEATURES variable contains one or more values that
 * should be disabled under normal circumstances: keeptemp keepwork

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] app-backup/mkstage4-0.3::didactic-duck  USE="test" 0 KiB

Total: 1 package (1 new), Size of downloads: 0 KiB

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) app-backup/mkstage4-0.3::didactic-duck
 * mkstage4-0.3.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                                     [ ok ]
>>> Unpacking source...
>>> Unpacking mkstage4-0.3.tar.gz to /var/tmp/portage/app-backup/mkstage4-0.3/work
>>> Source unpacked in /var/tmp/portage/app-backup/mkstage4-0.3/work
>>> Preparing source in /var/tmp/portage/app-backup/mkstage4-0.3/work/mkstage4-0.3 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-backup/mkstage4-0.3/work/mkstage4-0.3 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/app-backup/mkstage4-0.3/work/mkstage4-0.3 ...
>>> Source compiled.
>>> Test phase: app-backup/mkstage4-0.3
1..79
ok 1 /usr/bin/ping is included
ok 2 /usr/bin/lost+found is included
ok 3 /usr/src/linux-uname/.config is included
ok 4 /usr/src/linux-uname/vmlinux is included
ok 5 /lib/modules/uname/mod.ko is included
ok 6 /lib64/modules/uname/mod.ko is included
ok 7 /dev/* is excluded
ok 8 /var/tmp/* is excluded
ok 9 /media/* is excluded
ok 10 /mnt/* is excluded
ok 11 /proc/* is excluded
ok 12 /run/* is excluded
ok 13 /sys/* is excluded
ok 14 /tmp/* is excluded
ok 15 /var/lock/* is excluded
ok 16 /var/log/* is excluded
ok 17 /var/run/* is excluded
ok 18 /var/lib/docker/* is excluded
ok 19 /dev/ is included
ok 20 /var/tmp/ is included
ok 21 /media/ is included
ok 22 /mnt/ is included
ok 23 /proc/ is included
ok 24 /run/ is included
ok 25 /sys/ is included
ok 26 /tmp/ is included
ok 27 /var/lock/ is included
ok 28 /var/log/ is included
ok 29 /var/run/ is included
ok 30 /var/lib/docker/ is included
ok 31 /boot/kernel is included
ok 32 /.hiddenfile is included
ok 33 /var/log/**/.keep is included # skip TODO: Not yet implemented
ok 34 /home/user/.bash_history is included
ok 35 /root/.bash_history is included
ok 36 /home/user/chroot/var/tmp/file is included
ok 37 /usr/bin/ping is included
ok 38 /usr/bin/lost+found is excluded
ok 39 /lost+found is excluded
ok 40 /usr/bin/ping is included
ok 41 /usr/src/ is included
ok 42 /lib/modules/ is included
ok 43 /lib64/modules/ is included
ok 44 /usr/src/linux-test-uname/ is excluded
ok 45 /usr/src/linux-different-uname/ is excluded
ok 46 /lib/modules/test-uname/ is excluded
ok 47 /lib/modules/different-uname/ is excluded
ok 48 /lib64/modules/test-uname/ is excluded
ok 49 /lib64/modules/different-uname/ is excluded
ok 50 /usr/src/linux-test-uname/.config is included in ksrc
ok 51 /usr/src/linux-test-uname/vmlinux is included in ksrc
ok 52 /usr/src/linux-different-uname/ is excluded in ksrc
ok 53 /lib/modules/test-uname/mod.ko is included in kmod
ok 54 /lib64/modules/test-uname/mod.ko is included in kmod
ok 55 /lib/modules/different-uname/ is excluded in kmod
ok 56 /lib64/modules/different-uname/ is excluded in kmod
ok 57 /boot/kernel is excluded
ok 58 /boot/boot is included # skip TODO: Not yet implemented
ok 59 /var/lib/connman/file is excluded
ok 60 /var/lib/connman/ is included
ok 61 /home/user/.bash_history is exlucded
ok 62 /home/user/ is included
ok 63 /root/.bash_history is exlucded
ok 64 /root/ is included
ok 65 /var/db/repos/gentoo/app-backup is excluded
ok 66 /var/db/repos/gentoo/ is included
ok 67 /var/cache/distfiles/mkstage4.tar.gz is excluded
ok 68 /var/cache/distfiles/ is included
ok 69 /usr/portage/Manifest is excluded
ok 70 /usr/portage/ is included
ok 71 -e '/lost+found'
ok 72 -e 'user/.*'
ok 73 -e 'test/home/user/chroot/var/tmp/file'
ok 74 -e 'ccache/*'
ok 75 -e 'secrets'
ok 76 -i 'test/home/user/.keep and -e 'user/.*'
ok 77 -i 'test/etc/ssh/config and -e 'ssh'
ok 78 -i 'test/boot/boot' and -b
ok 79 -i 'test/mnt/5'
>>> Completed testing app-backup/mkstage4-0.3

>>> Install app-backup/mkstage4-0.3 into /var/tmp/portage/app-backup/mkstage4-0.3/image/
>>> Completed installing app-backup/mkstage4-0.3 into /var/tmp/portage/app-backup/mkstage4-0.3/image/

 * Final size of build directory: 92 KiB
 * Final size of installed tree:   8 KiB

>>> Installing (1 of 1) app-backup/mkstage4-0.3::didactic-duck
 * checking 1 files for package collisions
>>> Merging app-backup/mkstage4-0.3 to /
--- /usr/
--- /usr/bin/
>>> /usr/bin/mkstage4
>>> app-backup/mkstage4-0.3 merged.
>>> Regenerating /etc/ld.so.cache...
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * GNU info directory index is up-to-date.
test-ebuild \=mkstage4-0.3  19.66s user 11.02s system 100% cpu 30.524 total

Works with bats-core, which isn't yet merged, https://github.com/gentoo/gentoo/pull/14576

Looks like its a cli difference between bats (which is what your ebuild uses) and bats-core fork (which is how I got it to work above and what the mkstage4 github action uses). You probably just need to update https://github.com/TheChymera/overlay/blob/9e1b7353279982f150028458276e0f683499f951/app-backup/mkstage4/mkstage4-0.3.ebuild#L26 to something different for bats (non -core). Let me see..

lucianposton commented 4 years ago
src_test() {
    bats tests/* || die
}

The old bats doesn't have a -r flag to find the test files recursively.

TheChymera commented 4 years ago

@lucianposton amazing, works like this for now. Regarding your PR, try pinging Michał Górny --- he usually gets stuff done very helpfully and efficiently.

TheChymera commented 1 year ago

We have tests now. The ebuild passes them.