From ab20c63578933e48f3f900b333e3e23c7daf4b19 Mon Sep 17 00:00:00 2001 From: espie Date: Sun, 8 Oct 2023 09:17:27 +0000 Subject: [PATCH] add another two regression testing parts. Use a simple framework that allows me to redefine methods to not do a thing (maybe this will migrate to its own file if it grows enough) --- usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm | 23 ++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm index 1cf648880bf..b0dfa0a3614 100644 --- a/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm +++ b/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: AddCreateDelete.pm,v 1.53 2023/10/08 06:55:02 espie Exp $ +# $OpenBSD: AddCreateDelete.pm,v 1.54 2023/10/08 09:17:27 espie Exp $ # # Copyright (c) 2007-2014 Marc Espie # @@ -55,6 +55,24 @@ sub add_interactive_options($self) return $self; } +my $setup = { + nowantlib => sub() { + eval { + use OpenBSD::Dependencies::SolverBase; + no warnings qw(redefine); + package OpenBSD::Dependencies::SolverBase; + sub solve_wantlibs($, $) { 1 } + }; + }, + norun => sub() { + eval { + package OpenBSD::State; + sub _system(@) { 0 } + }; + }, +}; + + sub handle_options($state, $opt_string, @usage) { my $i; @@ -81,6 +99,9 @@ sub handle_options($state, $opt_string, @usage) if ($state->defines('REGRESSION_TESTING')) { for my $i (split(',', $state->defines('REGRESSION_TESTING'))) { $state->{regression}{$i} = 1; + if (defined $setup->{$i}) { + &{$setup->{$i}}(); + } } } } -- 2.20.1