commit: cf53d4052b51e7cdaf55638f63c44b3af6c5726b
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat May 17 11:31:07 2025 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat May 17 11:31:07 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf53d405
dev-python/filebytes: add custom tests
I've copied some minimal tests from the examples given in readme.
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
dev-python/filebytes/filebytes-0.10.2.ebuild | 14 +++++++++++++-
dev-python/filebytes/filebytes-9999.ebuild | 14 +++++++++++++-
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/dev-python/filebytes/filebytes-0.10.2.ebuild
b/dev-python/filebytes/filebytes-0.10.2.ebuild
index d7a86490fd24..0a8b30b7fa52 100644
--- a/dev-python/filebytes/filebytes-0.10.2.ebuild
+++ b/dev-python/filebytes/filebytes-0.10.2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -21,3 +21,15 @@ fi
LICENSE="BSD"
SLOT="0"
+
+python_test() {
+ "${EPYTHON}" - <<-EOF || die "Tests failed with ${EPYTHON}"
+ from filebytes.elf import *
+ elf_file = ELF('test-binaries/ls-x86')
+ print("elf", elf_file.elfHeader, elf_file.sections,
elf_file.segments)
+
+ from filebytes.pe import *
+ pe_file = PE('test-binaries/cmd-x86.exe')
+ print("pe", pe_file.imageDosHeader, pe_file.sections)
+ EOF
+}
diff --git a/dev-python/filebytes/filebytes-9999.ebuild
b/dev-python/filebytes/filebytes-9999.ebuild
index 21b8aecc4927..3dd61d92280a 100644
--- a/dev-python/filebytes/filebytes-9999.ebuild
+++ b/dev-python/filebytes/filebytes-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -21,3 +21,15 @@ fi
LICENSE="BSD"
SLOT="0"
+
+python_test() {
+ "${EPYTHON}" - <<-EOF || die "Tests failed with ${EPYTHON}"
+ from filebytes.elf import *
+ elf_file = ELF('test-binaries/ls-x86')
+ print("elf", elf_file.elfHeader, elf_file.sections,
elf_file.segments)
+
+ from filebytes.pe import *
+ pe_file = PE('test-binaries/cmd-x86.exe')
+ print("pe", pe_file.imageDosHeader, pe_file.sections)
+ EOF
+}