Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package os-autoinst for openSUSE:Factory checked in at 2026-04-10 17:52:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/os-autoinst (Old) and /work/SRC/openSUSE:Factory/.os-autoinst.new.21863 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "os-autoinst" Fri Apr 10 17:52:50 2026 rev:584 rq:1345686 version:5.1775744546.1ee50c6 Changes: -------- --- /work/SRC/openSUSE:Factory/os-autoinst/os-autoinst.changes 2026-04-09 16:23:45.220064339 +0200 +++ /work/SRC/openSUSE:Factory/.os-autoinst.new.21863/os-autoinst.changes 2026-04-10 18:01:53.711845701 +0200 @@ -2 +2 @@ -Thu Apr 09 08:40:48 UTC 2026 - [email protected] +Thu Apr 09 14:22:35 UTC 2026 - [email protected] @@ -4 +4 @@ -- Update to version 5.1775724038.b9411c7: +- Update to version 5.1775744546.1ee50c6: @@ -5,0 +6,4 @@ + * refactor: consolidate logic in _detect_serial_marker_capability + * style: use non-capturing group for BASH version detection + * fix(distribution): make PRETTY_SERIAL_MARKER reboot-safe + * refactor: early returns in _detect_serial_marker_capability @@ -10 +13,0 @@ - * chore(AGENTS.md): extend with better proactive style following Old: ---- os-autoinst-5.1775724038.b9411c7.obscpio New: ---- os-autoinst-5.1775744546.1ee50c6.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ os-autoinst-devel-test.spec ++++++ --- /var/tmp/diff_new_pack.sODfsg/_old 2026-04-10 18:01:58.528044002 +0200 +++ /var/tmp/diff_new_pack.sODfsg/_new 2026-04-10 18:01:58.544044661 +0200 @@ -18,7 +18,7 @@ %define short_name os-autoinst-devel Name: %{short_name}-test -Version: 5.1775724038.b9411c7 +Version: 5.1775744546.1ee50c6 Release: 0 Summary: Test package for %{short_name} License: GPL-2.0-or-later ++++++ os-autoinst-openvswitch-test.spec ++++++ --- /var/tmp/diff_new_pack.sODfsg/_old 2026-04-10 18:01:58.748053060 +0200 +++ /var/tmp/diff_new_pack.sODfsg/_new 2026-04-10 18:01:58.756053390 +0200 @@ -19,7 +19,7 @@ %define name_ext -test %define short_name os-autoinst-openvswitch Name: %{short_name}%{?name_ext} -Version: 5.1775724038.b9411c7 +Version: 5.1775744546.1ee50c6 Release: 0 Summary: test package for %{short_name} License: GPL-2.0-or-later ++++++ os-autoinst-test.spec ++++++ --- /var/tmp/diff_new_pack.sODfsg/_old 2026-04-10 18:01:59.004063601 +0200 +++ /var/tmp/diff_new_pack.sODfsg/_new 2026-04-10 18:01:59.008063766 +0200 @@ -19,7 +19,7 @@ %define name_ext -test %define short_name os-autoinst Name: %{short_name}%{?name_ext} -Version: 5.1775724038.b9411c7 +Version: 5.1775744546.1ee50c6 Release: 0 Summary: test package for os-autoinst License: GPL-2.0-or-later ++++++ os-autoinst.spec ++++++ --- /var/tmp/diff_new_pack.sODfsg/_old 2026-04-10 18:01:59.268074472 +0200 +++ /var/tmp/diff_new_pack.sODfsg/_new 2026-04-10 18:01:59.268074472 +0200 @@ -17,7 +17,7 @@ Name: os-autoinst -Version: 5.1775724038.b9411c7 +Version: 5.1775744546.1ee50c6 Release: 0 Summary: OS-level test automation License: GPL-2.0-or-later ++++++ os-autoinst-5.1775724038.b9411c7.obscpio -> os-autoinst-5.1775744546.1ee50c6.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1775724038.b9411c7/distribution.pm new/os-autoinst-5.1775744546.1ee50c6/distribution.pm --- old/os-autoinst-5.1775724038.b9411c7/distribution.pm 2026-04-09 10:40:38.000000000 +0200 +++ new/os-autoinst-5.1775744546.1ee50c6/distribution.pm 2026-04-09 16:22:26.000000000 +0200 @@ -445,6 +445,11 @@ $pc = "PROMPT_COMMAND='if [ -n \"\$__OA_MARK\" ]; then echo \"\${__OA_MARK}-\$?-\" > $dev; unset __OA_MARK; fi'"; } testapi::type_string "$pc\n"; + my $marker_match = $level == 3 ? 'OA:DONE' : '__OA_MARK'; + my $hook_cmd = "for f in ~/.bashrc ~/.profile; do grep -q '$marker_match' \"\$f\" 2>/dev/null || cat <<'EOF' >> \"\$f\"\n$pc\nEOF\ndone\n"; + testapi::type_string $hook_cmd; + my $console = testapi::current_console() // 'sut'; + $self->{_serial_marker_hook_installed}->{$console} = 1; } =head2 _detect_serial_marker_capability @@ -461,31 +466,35 @@ sub _detect_serial_marker_capability ($self) { my $console = testapi::current_console() // 'sut'; - return $self->{_serial_marker_level}->{$console} if $self->{_serial_marker_level}->{$console}; + if (my $level = $self->{_serial_marker_level}->{$console}) { + return $level if $level < 2 || $self->{_serial_marker_hook_installed}->{$console}; + + $self->install_serial_marker_hook($level); + return $level; + } my $level = 1; my $pretty = testapi::get_var('PRETTY_SERIAL_MARKER'); my $serial_term = testapi::is_serial_terminal(); - if ($pretty && !$serial_term) { - testapi::type_string "echo \"BASH:\$BASH_VERSION:\" > /dev/$testapi::serialdev\n"; - my $out = testapi::wait_serial(qr/BASH:([^:]*):/, 10); - if ($out && $out =~ /BASH:([3-9]|\d{2,})/) { - $level = 2; - # Check if bash and history features are available to use pretty serial markers - testapi::type_string "type fc && set -o | grep -q 'history.*on' && echo \"FC:OK:\" > /dev/$testapi::serialdev\n"; - if (testapi::wait_serial(qr/FC:OK:/, 10)) { - $level = 3; - } - $self->install_serial_marker_hook($level); - bmwqemu::log_call("serial_marker: console '$console' Level $level detected"); - } - else { - bmwqemu::log_call("serial_marker: console '$console' Level 1 detected (fallback)"); - return 1; + return $self->{_serial_marker_level}->{$console} = $level if !$pretty || $serial_term; + + testapi::type_string "echo \"BASH:\$BASH_VERSION:\" > /dev/$testapi::serialdev\n"; + my $out = testapi::wait_serial(qr/BASH:([^:]*):/, 10); + if ($out && $out =~ /BASH:(?:[3-9]|\d{2,})/) { + $level = 2; + # Check if bash and history features are available to use pretty serial markers + testapi::type_string "type fc && set -o | grep -q 'history.*on' && echo \"FC:OK:\" > /dev/$testapi::serialdev\n"; + if (testapi::wait_serial(qr/FC:OK:/, 10)) { + $level = 3; } + $self->install_serial_marker_hook($level); + bmwqemu::log_call("serial_marker: console '$console' Level $level detected"); + } + else { + bmwqemu::log_call("serial_marker: console '$console' Level 1 detected (fallback)"); + return 1; } - $self->{_serial_marker_level}->{$console} = $level; - return $level; + return $self->{_serial_marker_level}->{$console} = $level; } 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1775724038.b9411c7/t/05-distribution.t new/os-autoinst-5.1775744546.1ee50c6/t/05-distribution.t --- old/os-autoinst-5.1775724038.b9411c7/t/05-distribution.t 2026-04-09 10:40:38.000000000 +0200 +++ new/os-autoinst-5.1775744546.1ee50c6/t/05-distribution.t 2026-04-09 16:22:26.000000000 +0200 @@ -137,6 +137,50 @@ throws_ok { $d->script_run('foo') } qr/typing command 'foo' timed out/, 'typing error handled in Level 1'; }; +subtest 'reboot_safety' => sub { + my $d = distribution->new; + my $mock_testapi = Test::MockModule->new('testapi'); + my $mock_bmwqemu = Test::MockModule->new('bmwqemu'); + $mock_bmwqemu->noop('log_call'); + my $typed_string = ''; + $mock_testapi->redefine(query_isotovideo => sub { }); + $mock_testapi->redefine(type_string => sub { $typed_string .= $_[0] }); + $mock_testapi->redefine(hashed_string => sub { return 'SR' . substr $_[0], 0, 8 }); + $mock_testapi->redefine(is_serial_terminal => sub { 0 }); + $mock_testapi->redefine(current_console => sub { 'test-console' }); + $mock_testapi->redefine(get_var => sub { $_[0] eq 'PRETTY_SERIAL_MARKER' ? 1 : undef }); + $testapi::serialdev = 'ttyS0'; + + # Initial detection (Level 3) + $mock_testapi->redefine(wait_serial => sub { + my ($regexp) = @_; + return 'BASH:4.4:' if ref($regexp) eq 'Regexp' && 'BASH:4.4:' =~ $regexp; + return 'FC:OK:' if ref($regexp) eq 'Regexp' && 'FC:OK:' =~ $regexp; + return 'OA:DONE-0-'; + }); + + $d->script_run('foo'); + like $typed_string, qr/PROMPT_COMMAND=.*OA:DONE/, 'Initial install'; + like $typed_string, qr/\.bashrc/, 'Persistence added'; + $typed_string = ''; + + # Simulate console selection (e.g. after reboot/login) + $d->console_selected('test-console'); + + # Case 1: still there (e.g. persistent) + $typed_string = ''; + $d->script_run('bar'); + unlike $typed_string, qr/PROMPT_COMMAND=.*OA:DONE/, 'No re-install if still there'; + like $typed_string, qr/bar\n/, 'Command typed'; + + # Case 2: manual clear (e.g. if we know it was lost) + delete $d->{_serial_marker_hook_installed}->{'test-console'}; + $typed_string = ''; + $d->script_run('baz'); + like $typed_string, qr/PROMPT_COMMAND=.*OA:DONE/, 'Re-install if missing'; + like $typed_string, qr/baz\n/, 'Command typed after re-install'; +}; + subtest 'sut_marker' => sub { my $d = distribution->new; is $d->sut_marker('ls -la /tmp'), 'OA:ls -11/tmp', 'sut_marker for normal command'; ++++++ os-autoinst.obsinfo ++++++ --- /var/tmp/diff_new_pack.sODfsg/_old 2026-04-10 18:02:03.116232914 +0200 +++ /var/tmp/diff_new_pack.sODfsg/_new 2026-04-10 18:02:03.120233078 +0200 @@ -1,5 +1,5 @@ name: os-autoinst -version: 5.1775724038.b9411c7 -mtime: 1775724038 -commit: b9411c73c5e75a6beb23e3a3b6c9f58d90a4c6db +version: 5.1775744546.1ee50c6 +mtime: 1775744546 +commit: 1ee50c6b1d20225a21621ae0444360c8cee56374
