From d99900cb21784d072248a3840b7d3accc93daa1c Mon Sep 17 00:00:00 2001 From: Mark Roberts Date: Thu, 16 Nov 2023 14:25:15 -0800 Subject: [PATCH] Update Math project for Java 11 (#540) --- framework/core/Project/Math.pm | 13 +++++- framework/core/Utils.pm | 40 +++++++++++++++++++ .../2c443ab8b0efce5485f63eed62213091a188c993 | 2 + 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 framework/projects/Math/failing_tests/2c443ab8b0efce5485f63eed62213091a188c993 diff --git a/framework/core/Project/Math.pm b/framework/core/Project/Math.pm index 19eaeea0c..3ea121120 100644 --- a/framework/core/Project/Math.pm +++ b/framework/core/Project/Math.pm @@ -50,7 +50,8 @@ sub new { my $name = "commons-math"; my $vcs = Vcs::Git->new($PID, "$REPO_DIR/$name.git", - "$PROJECTS_DIR/$PID/$BUGS_CSV_ACTIVE"); + "$PROJECTS_DIR/$PID/$BUGS_CSV_ACTIVE", + \&_post_checkout); return $class->SUPER::new($PID, $name, $vcs); } @@ -101,6 +102,16 @@ sub _layout2 { return {src=>$src, test=>$test}; } +sub _post_checkout { + my ($self, $revision_id, $work_dir) = @_; + my $vid = $self->{_vcs}->lookup_vid($revision_id); + + # Convert the file encoding of problematic files + my $result = determine_layout($self, $revision_id); + Utils::convert_file_encoding($work_dir."/".$result->{src}."/org/apache/commons/math3/stat/correlation/StorelessBivariateCovariance.java"); + Utils::convert_file_encoding($work_dir."/".$result->{src}."/org/apache/commons/math3/stat/correlation/StorelessCovariance.java"); +} + # # Remove looping tests in addition to the broken ones # diff --git a/framework/core/Utils.pm b/framework/core/Utils.pm index 6e7403922..c5e50d48d 100644 --- a/framework/core/Utils.pm +++ b/framework/core/Utils.pm @@ -276,6 +276,46 @@ sub print_env { =pod +=item C + +Print the current Perl execution stack trace to F. + +=cut + +sub print_perl_call_stack { + my ($package, $filename, $line, $subroutine, $hasargs, $wantarray, $evaltext, $is_require, $hints, $bitmask, $hinthash); + my $i = 1; + my @r; + while (@r = caller($i)) { + ($package, $filename, $line, $subroutine, $hasargs, $wantarray, $evaltext, $is_require, $hints, $bitmask, $hinthash) = @r; + print(STDERR "$filename:$line $subroutine\n"); + $i++; + } +} + +=pod + +=item C + +Copies the original file to .bak then converts +the encoding of file_name from iso-8859-1 to utf-8. + +=cut + +sub convert_file_encoding { + @_ == 1 or die $ARG_ERROR; + my ($file_name) = @_; + if (-e $file_name){ + rename($file_name, $file_name.".bak"); + open(OUT, '>'.$file_name) or die $!; + my $converted_file = `iconv -f iso-8859-1 -t utf-8 $file_name.bak`; + print OUT $converted_file; + close(OUT); + } +} + +=pod + =item C Returns true if this process is running under continuous integration. diff --git a/framework/projects/Math/failing_tests/2c443ab8b0efce5485f63eed62213091a188c993 b/framework/projects/Math/failing_tests/2c443ab8b0efce5485f63eed62213091a188c993 new file mode 100644 index 000000000..49e2af0ba --- /dev/null +++ b/framework/projects/Math/failing_tests/2c443ab8b0efce5485f63eed62213091a188c993 @@ -0,0 +1,2 @@ +## commons-math: 2c443ab8b0efce5485f63eed62213091a188c993 ## +--- org.apache.commons.math.estimation.MinpackTest::testMinpackMeyer