$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@codeweavers.com --- 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 37ebf9a62..279b7bccd 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();