Francois Gouget : testbot: Fix the VM Missions validation.
Alexandre Julliard
julliard at winehq.org
Mon Dec 2 13:24:48 CST 2019
Module: tools
Branch: master
Commit: 77c97d74279b208bf05d2da7453d4defbe2464fb
URL: https://source.winehq.org/git/tools.git/?a=commit;h=77c97d74279b208bf05d2da7453d4defbe2464fb
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Mon Dec 2 13:51:16 2019 +0100
testbot: Fix the VM Missions validation.
$Item->Xxx("foo") does not go through PutColValue()!
Instead AUTOLOAD sets the specified property directly, maybe fori
performance reasons, and PutColValue() is only used by DBIBackend.pm.
WineTestBot::VMs was overriding PutColValue() to only revalidate a VM's
missions field if either the VM Type of Missions field were modified.
But instead ValidateMissions was always true after loading a VM from the
database (because of the PutColValue() calls), and not when creating a
new VM (in which case all the properties are set through AUTOLOAD).
So take a snapshot of the initial Type and Missions values when the
database code resets the IsModified field by calling ResetModified();
and then revalidate them whenever they have changed.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/lib/WineTestBot/VMs.pm | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index 37ebf9a..279b7bc 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -304,15 +304,13 @@ sub KillChild($)
$self->ChildPid(undef);
}
-sub PutColValue($$$)
+sub ResetModified($)
{
- my ($self, $ColName, $Value) = @_;
+ my ($self) = @_;
- $self->SUPER::PutColValue($ColName, $Value);
- if ($self->{IsModified} and ($ColName eq "Type" or $ColName eq "Missions"))
- {
- $self->{ValidateMissions} = 1;
- }
+ $self->SUPER::ResetModified();
+ $self->{OldType} = $self->Type;
+ $self->{OldMissions} = $self->Missions;
}
my $_SupportedMissions = {
@@ -331,7 +329,8 @@ sub Validate($)
{
return ("Role", "Only win32, win64 and wine VMs can have a role of '" . $self->Role . "'");
}
- if ($self->{ValidateMissions})
+ if ($self->ValuesDiffer($self->{OldType}, $self->Type) or
+ $self->ValuesDiffer($self->{OldMissions}, $self->Missions))
{
my ($ErrMessage, $Missions) = ParseMissionStatement($self->Missions);
return ("Missions", $ErrMessage) if (defined $ErrMessage);
@@ -350,7 +349,8 @@ sub Validate($)
}
}
}
- delete $self->{ValidateMissions};
+ $self->{OldType} = $self->Type;
+ $self->{OldMissions} = $self->Missions;
}
return $self->SUPER::Validate();
More information about the wine-cvs
mailing list