Support for running unit tests automatically.
Created attachment 108124 [details] Patch
I think it is better to notify this contribution to webkit-dev mailing list first.
Comment on attachment 108124 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=108124&action=review Informal r- for the reasons below. > Tools/Scripts/run-efl-tests:52 > +sub runTest > +{ > + my $args = @_[0]; > + my $pathToBinary = "Source/Programs/EUnitTests"; > + my $utName = ""; > + if (length($args) > 0) { > + $utName = " --gtest_filter=" . $args . ".*" . "\n"; > + } > + exit system($pathToBinary . $utName); My Perl-fu is a bit rusty, but wouldn't the following be more readable and less prone to escaping problems? sub runTest { my ($testFilter) = @_; my $pathToTestUtility = 'Source/Programs/EUnitTests'; my @testArgs = ($pathToTestUtility); push @testArgs, ('--gtest_filter', "${testFilter}.*\n") if $testFilter; return system(@testArgs); } > Tools/Scripts/run-efl-tests:57 > +sub usage > +{ > + my $programName = basename($0); Even though this is fine, the common pattern in WebKitPerl is to declare subroutine parameters as such (notice the more descriptive name as well): sub printUsage { my ($programName) = @_; ... } > Tools/Scripts/run-efl-tests:64 > + print STDERR $usageText; Why is this printed to STDERR? > Tools/Scripts/run-efl-tests:65 > + exit 1; Why does the program return 1 when successfully printing the help output?
(In reply to comment #3) > (From update of attachment 108124 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=108124&action=review > > Informal r- for the reasons below. > > > Tools/Scripts/run-efl-tests:52 > > +sub runTest > > +{ > > + my $args = @_[0]; > > + my $pathToBinary = "Source/Programs/EUnitTests"; > > + my $utName = ""; > > + if (length($args) > 0) { > > + $utName = " --gtest_filter=" . $args . ".*" . "\n"; > > + } > > + exit system($pathToBinary . $utName); > > My Perl-fu is a bit rusty, but wouldn't the following be more readable and less prone to escaping problems? > > sub runTest { > my ($testFilter) = @_; > my $pathToTestUtility = 'Source/Programs/EUnitTests'; > my @testArgs = ($pathToTestUtility); > > push @testArgs, ('--gtest_filter', "${testFilter}.*\n") if $testFilter; > return system(@testArgs); > } > Your suggestion is good, I'm bit new to the perl so your Perl-fu is better than mine > > Tools/Scripts/run-efl-tests:57 > > +sub usage > > +{ > > + my $programName = basename($0); > > Even though this is fine, the common pattern in WebKitPerl is to declare subroutine parameters as such (notice the more descriptive name as well): > > sub printUsage > { > my ($programName) = @_; > ... > } > > > Tools/Scripts/run-efl-tests:64 > > + print STDERR $usageText; > > Why is this printed to STDERR? Allows stream redirection. "Help" in this context informs the user, that something did wrong. > > > Tools/Scripts/run-efl-tests:65 > > + exit 1; > > Why does the program return 1 when successfully printing the help output? Point at, this is a failure situation
Created attachment 108666 [details] Patch
Comment on attachment 108666 [details] Patch LGTM.
Coming to think of it again, I wonder if this script is really needed. Wouldn't using CMake's infrastructure for tests be enough (ie. running `make test' then runs the unit tests)?
I also thought about it. On the other hand, there are already available similar scripts for other ports: run-gtk-tests, run-chromium-webkit-unit-tests, run-api-tests. I'am not sure if this is some kind of convention of adding this kind of scripts. Apart from this we could also use CMake infrastructure.
If there is a script for running EFL test, I'm please with it. But, it looks this patch can't be landed until other patches are landed. In addition, I think you need to notify this patch to webkit-dev. I think you have to get agreement from webkit community or reviewers.
I'm not sure if this makes sense anymore. I think it can be done by using CTest and a build target. We don't have a global runner anymore. See bug 87251.
(In reply to comment #10) > I'm not sure if this makes sense anymore. I think it can be done by using CTest and a build target. We don't have a global runner anymore. See bug 87251. Should we close this bug?
*** This bug has been marked as a duplicate of bug 87251 ***
Comment on attachment 108666 [details] Patch Clearing r? flag from the patch.