Bug#1010338: autopkgtest: Option --test-name and debian/tests/control test-name raise exception

2022-08-06 Thread Guilhem Moulin
Control: tag -1 patch

The trivial patch attached fixes the exception.  Seems it was a
regression caused by the fix for #960267.

cheers
-- 
Guilhem.
diff --git a/lib/testdesc.py b/lib/testdesc.py
index 3e696a2..39e1ecb 100644
--- a/lib/testdesc.py
+++ b/lib/testdesc.py
@@ -678,7 +678,7 @@ def parse_debian_source(srcdir, testbed_caps, testbed_arch, control_path=None,
 raise InvalidControl('*', 'missing "Tests" or "Test-Command"'
  ' field')
 except Unsupported as u:
-if testname is None or n == testname:
+if testname is None:
 u.report()
 some_skipped = True
 


signature.asc
Description: PGP signature


Bug#1010338: autopkgtest: Option --test-name and debian/tests/control test-name raise exception

2022-07-19 Thread Guilhem Moulin
Package: autopkgtest
Version: 5.22
Followup-For: Bug #1010338

Unfortunately the exception is also triggered for non-fatal errors:

$ cat debian/tests/control.crash
Test-Command: /bin/true
Depends: coreutils
Restrictions: isolation-machine

Test-Command: /bin/true
Depends: coreutils

$ autopkgtest --override-control=debian/tests/control.crash 
--test-name=command2 \
/tmp/coreutils_8.32-4.1_amd64.deb ./ -- schroot sid-amd64-sbuild
[…]
command1 SKIP Test requires machine-level isolation but testbed 
does not provide that
autopkgtest [00:05:45]: build not needed
autopkgtest [00:05:45]: ERROR: unexpected error:
Traceback (most recent call last):
  File "/usr/share/autopkgtest/lib/testdesc.py", line 675, in 
parse_debian_source
test.check_testbed_compat(testbed_caps, ignore_restrictions)
  File "/usr/share/autopkgtest/lib/testdesc.py", line 171, in 
check_testbed_compat
raise Unsupported(self.name,
testdesc.Unsupported: Unsupported test command1: Test requires 
machine-level isolation but testbed does not provide that

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/autopkgtest", line 839, in main
process_actions()
  File "/usr/bin/autopkgtest", line 763, in process_actions
(tests, skipped) = testdesc.parse_debian_source(
  File "/usr/share/autopkgtest/lib/testdesc.py", line 681, in 
parse_debian_source
if testname is None or n == testname:
UnboundLocalError: local variable 'n' referenced before assignment

Interestingly, it works without the --test-name:

$ autopkgtest --override-control=debian/tests/control.crash \
/tmp/coreutils_8.32-4.1_amd64.deb ./ -- schroot sid-amd64-sbuild
[…]
autopkgtest [00:12:45]: test command2: /bin/true
autopkgtest [00:12:45]: test command2: [---
autopkgtest [00:12:45]: test command2: ---]
autopkgtest [00:12:45]: test command2:  - - - - - - - - - - results - - - - 
- - - - - -
command2 PASS
autopkgtest [00:12:45]:  summary
command1 SKIP Test requires machine-level isolation but testbed 
does not provide that
command1 SKIP Test requires machine-level isolation but testbed 
does not provide that
command2 PASS

But of course sometimes I have more than one test without ‘Restrictions:
isolation-*’ and and want to run a single one at a time :-)

-- 
Guilhem.


signature.asc
Description: PGP signature


Bug#1010338: autopkgtest: Option --test-name and debian/tests/control test-name raise exception

2022-04-29 Thread Carles Pina i Estany


Hi,

On Apr/29/2022, Simon McVittie wrote:
> On Fri, 29 Apr 2022 at 09:54:48 +0200, Carles Pina i Estany wrote:
> > testdesc.Unsupported: Unsupported test command1: unknown field Test-name
> 
> This is correctly reporting an error. The correct syntax as documented in
> https://salsa.debian.org/ci-team/autopkgtest/blob/master/doc/README.package-tests.rst
> is:
> 
> Features: test-name=foo
> Test-Command: some-test-command
> Depends: a-package
> Restrictions: allow-stderr

Sorry for the noise, thanks for the link!

> >   File "/usr/share/autopkgtest/lib/testdesc.py", line 681, in 
> > parse_debian_source
> > if testname is None or n == testname:
> > UnboundLocalError: local variable 'n' referenced before assignment
> 
> That's genuinely a bug in autopkgtest's error-handling.

Thanks very much,

-- 
Carles Pina i Estany
https://carles.pina.cat



Bug#1010338: autopkgtest: Option --test-name and debian/tests/control test-name raise exception

2022-04-29 Thread Simon McVittie
On Fri, 29 Apr 2022 at 09:54:48 +0200, Carles Pina i Estany wrote:
> testdesc.Unsupported: Unsupported test command1: unknown field Test-name

This is correctly reporting an error. The correct syntax as documented in
https://salsa.debian.org/ci-team/autopkgtest/blob/master/doc/README.package-tests.rst
is:

Features: test-name=foo
Test-Command: some-test-command
Depends: a-package
Restrictions: allow-stderr

>   File "/usr/share/autopkgtest/lib/testdesc.py", line 681, in 
> parse_debian_source
> if testname is None or n == testname:
> UnboundLocalError: local variable 'n' referenced before assignment

That's genuinely a bug in autopkgtest's error-handling.

smcv



Bug#1010338: autopkgtest: Option --test-name and debian/tests/control test-name raise exception

2022-04-29 Thread Carles Pina i Estany
Package: autopkgtest
Version: 5.21
Severity: normal
Tags: upstream

Dear Maintainers,

I have a debian/tests/control such as:

---
test-name: foo
Test-Command: some-test-command
Depends: a-package
Restrictions: allow-stderr
---

And I execute:

$ autopkgtest some-package_0.0.1_all.deb --test-name=foo -- null

Expected: the test to execute (and only that specific test).

Actual:
--
autopkgtest [09:47:42]: starting date: 2022-04-29
autopkgtest [09:47:42]: version 5.21
autopkgtest [09:47:42]: host pinux; command line: /usr/bin/autopkgtest 
python3-foo_0.0.1_all.deb --test-name=foo -- null
autopkgtest [09:47:43]: testbed dpkg architecture: amd64
autopkgtest [09:47:43]: testbed running kernel: Linux 5.10.0-13-amd64 #1 SMP 
Debian 5.10.106-1 (2022-03-17)
autopkgtest [09:47:43]:  built-tree .
autopkgtest [09:47:43]: testing package foo version 0.0.1
autopkgtest [09:47:43]: ERROR: unexpected error:
Traceback (most recent call last):
  File "/usr/share/autopkgtest/lib/testdesc.py", line 671, in 
parse_debian_source
_debian_check_unknown_fields(name, record)
  File "/usr/share/autopkgtest/lib/testdesc.py", line 248, in 
_debian_check_unknown_fields
raise Unsupported(name, 'unknown field %s' % unknown_keys.pop())
testdesc.Unsupported: Unsupported test command1: unknown field Test-name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/autopkgtest", line 832, in main
process_actions()
  File "/usr/bin/autopkgtest", line 762, in process_actions
(tests, skipped) = testdesc.parse_debian_source(
  File "/usr/share/autopkgtest/lib/testdesc.py", line 681, in 
parse_debian_source
if testname is None or n == testname:
UnboundLocalError: local variable 'n' referenced before assignment
--

I tried writing "Test-name" instead of "test-name" in the file
debian/tests/control . Same result.

I've had a quick look at the source but I haven't fixed it. I might have
another look next week.

Thank you very much for your attention, best regards,

-- System Information:
Debian Release: 11.3
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-security')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-13-amd64 (SMP w/4 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=ca_ES.UTF-8, LC_CTYPE=ca_ES.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages autopkgtest depends on:
ii  apt-utils   2.2.4
ii  libdpkg-perl1.20.9
ii  procps  2:3.3.17-5
ii  python3 3.9.2-3
ii  python3-debian  0.1.39

Versions of packages autopkgtest recommends:
ii  autodep8  0.24

Versions of packages autopkgtest suggests:
pn  fakemachine   
pn  lxc   
pn  lxd   
pn  ovmf  
pn  ovmf-ia32 
pn  qemu-efi-aarch64  
pn  qemu-efi-arm  
pn  qemu-system   
ii  qemu-utils1:5.2+dfsg-11+deb11u1
ii  schroot   1.6.10-12
ii  vmdb2 0.22-1

-- no debconf information