From e24eadd85bf2e74565de1a9b4bd52ce9f2459e86 Mon Sep 17 00:00:00 2001 From: Mark Roberts Date: Thu, 26 Oct 2023 13:57:02 -0700 Subject: [PATCH 1/4] update Lang project for Java 11 --- framework/core/Project/Lang.pm | 73 ++++++- framework/projects/Lang/active-bugs.csv | 1 - .../Lang/compile-errors/test-1-10.diff | 71 ++++++ .../Lang/compile-errors/test-1-4.diff | 12 ++ .../Lang/compile-errors/test-14-16.diff | 71 ++++++ .../Lang/compile-errors/test-17-20.diff | 73 +++++++ .../Lang/compile-errors/test-21-21.diff | 67 ++++++ .../Lang/compile-errors/test-42-65.diff | 14 ++ .../Lang/compile-errors/test-44-48.diff | 19 ++ .../Lang/compile-errors/test-5-27.diff | 12 ++ framework/projects/Lang/deprecated-bugs.csv | 1 + .../04babff3798680e012646988841bcc710a9e3c54 | 2 + .../127e6e338f088b82eea1967d31c1abf8d51a364f | 1 + .../14a0cc2a9baf84a97348263975082ef3857daf97 | 1 + .../1ced894df70d66f3a786c2c8cd6e23e0d4263d91 | 1 + .../2dc56182579703153e5c9886b3ecd22bbc348b49 | 2 + .../2f8f67ab2939f1c23f09c8764e04ea2da0479332 | 2 + .../34a6449c90a3b6074111a6bcbd31ad00ac1570f3 | 1 + .../56550bf2779990da78d2bac1d8287c8a693c6e4b | 2 + .../65a6458eaa2e1f88278e4bb5753a68bd825e3a80 | 2 + .../711e204e73f24e32acb3727a5d9d3b351b6639d1 | 2 + .../75d931a3264b73caa9cdd7d3373375cc33008ddf | 1 + .../825481f019e4482e5ea74d5b0b5e5c438535cb68 | 1 + .../8f675dd3cbfb8f552bdbbe1cfc646ba5b367983b | 1 + .../ad72b9f2bf37bd61af18bde67c1622d90a5d8766 | 2 + .../bc52782cd84f4356d2984e1aa01806f81754eb08 | 1 + .../cf20d13c64da51becd1351befe02a06144fd6fc1 | 2 + .../e199d381f8c199801fee2d40a7f3ea1380700631 | 1 + .../e9e167f9ebc7a73c5847745688ae127ecff6e2b1 | 1 + framework/projects/Lang/patches/48.src.patch | 11 +- framework/test/test_verify_bugs.sh | 4 + framework/test/test_verify_bugs.sh.Debug | 203 ++++++++++++++++++ framework/test/test_verify_bugs.sh.Lang | 201 +++++++++++++++++ framework/test/test_verify_bugs.sh.orig | 197 +++++++++++++++++ 34 files changed, 1043 insertions(+), 13 deletions(-) create mode 100644 framework/projects/Lang/compile-errors/test-1-10.diff create mode 100644 framework/projects/Lang/compile-errors/test-1-4.diff create mode 100644 framework/projects/Lang/compile-errors/test-14-16.diff create mode 100644 framework/projects/Lang/compile-errors/test-17-20.diff create mode 100644 framework/projects/Lang/compile-errors/test-21-21.diff create mode 100644 framework/projects/Lang/compile-errors/test-42-65.diff create mode 100644 framework/projects/Lang/compile-errors/test-44-48.diff create mode 100644 framework/projects/Lang/compile-errors/test-5-27.diff create mode 100755 framework/test/test_verify_bugs.sh.Debug create mode 100755 framework/test/test_verify_bugs.sh.Lang create mode 100755 framework/test/test_verify_bugs.sh.orig diff --git a/framework/core/Project/Lang.pm b/framework/core/Project/Lang.pm index 0f8056846..81c618be3 100644 --- a/framework/core/Project/Lang.pm +++ b/framework/core/Project/Lang.pm @@ -39,6 +39,7 @@ use warnings; use Constants; use Vcs::Git; +use File::Path 'rmtree'; our @ISA = qw(Project); my $PID = "Lang"; @@ -56,15 +57,34 @@ sub new { return $class->SUPER::new($PID, $name, $vcs); } +sub printstack { + 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 "$filename:$line $subroutine\n"; + $i++; + } +} + # # Determines the directory layout for sources and tests # sub determine_layout { @_ == 2 or die $ARG_ERROR; - my ($self, $rev_id) = @_; - my $dir = $self->{prog_root}; - my $result = _layout1($dir) // _layout2($dir); - die "Unknown layout for revision: ${rev_id}" unless defined $result; + my ($self, $revision_id) = @_; + my $work_dir = $self->{prog_root}; + + # Only two sets of layouts in this case + my $result; + if (-e "$work_dir/src/main"){ + $result = {src=>"src/main/java", test=>"src/test/java"}; + } + if (-e "$work_dir/src/java"){ + $result = {src=>"src/java", test=>"src/test"}; + } + die "Unknown layout for revision: ${revision_id}" unless defined $result; return $result; } @@ -102,15 +122,58 @@ sub _layout2 { return {src=>$src, test=>$test}; } +## +## Converts file encoding from iso-8859-1 to utf-8 +## +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); + } +} + # # Copy the generated build.xml, if necessary. # 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); + convert_file_encoding($work_dir."/".$result->{src}."/org/apache/commons/lang3/text/translate/EntityArrays.java"); + convert_file_encoding($work_dir."/".$result->{src}."/org/apache/commons/lang/Entities.java"); + + # remove old pre Java 1.5 code + print($work_dir."/".$result->{src}."/org/apache/commons/lang/enum\n"); + rmtree($work_dir."/".$result->{src}."/org/apache/commons/lang/enum"); + rmtree($work_dir."/".$result->{test}."/org/apache/commons/lang/enum"); + + # Fix compilation errors if necessary + my $compile_errors = "$PROJECTS_DIR/$self->{pid}/compile-errors/"; + opendir(DIR, $compile_errors) or die "Could not find compile-errors directory."; + my @entries = readdir(DIR); + closedir(DIR); + foreach my $file (@entries) { + if ($file =~ /-(\d+)-(\d+).diff/) { + if ($vid >= $1 && $vid <= $2) { + $self->apply_patch($work_dir, "$compile_errors/$file") + or confess("Couldn't apply patch ($file): $!"); + } + } + } # Check whether ant build file exists unless (-e "$work_dir/build.xml") { - system("cp $PROJECTS_DIR/$PID/build_files/$revision_id/* $work_dir"); + my $build_files_dir = "$PROJECTS_DIR/$PID/build_files/$revision_id"; + if (-d "$build_files_dir") { + Utils::exec_cmd("cp -r $build_files_dir/* $work_dir", "Copy generated Ant build file") or die; + } } } diff --git a/framework/projects/Lang/active-bugs.csv b/framework/projects/Lang/active-bugs.csv index 00db1ffd0..22f420389 100644 --- a/framework/projects/Lang/active-bugs.csv +++ b/framework/projects/Lang/active-bugs.csv @@ -22,7 +22,6 @@ bug.id,revision.id.buggy,revision.id.fixed,report.id,report.url 22,7e8d044b7b8c6d2786a88f416d17eed2f472445c,2270d830fda743de1ce8a61e33b9542cb39a0f4b,LANG-662,https://issues.apache.org/jira/browse/LANG-662 23,66e42dc8b43d37ff011de69586f8e6764c4b3164,249788d799ca1c3964062bdc5c19a51ecc05c2f7,LANG-636,https://issues.apache.org/jira/browse/LANG-636 24,7df70a8c6b14452767ac932a14640e32a1dc16da,8e2f4ddb9a1ecd7a1bf7d752c2c891d630287036,LANG-664,https://issues.apache.org/jira/browse/LANG-664 -25,44dbf85b6a7156d550ba62210412015058336281,dd5f8ea30755268dc43bbf2cd5024412674eb1b0,LANG-658,https://issues.apache.org/jira/browse/LANG-658 26,f7f19a3d2f98f48924d38fec2308dc3db83445d8,14a0cc2a9baf84a97348263975082ef3857daf97,LANG-645,https://issues.apache.org/jira/browse/LANG-645 27,bbcba273ad4322e76a90bcb867cbea108134717c,50c1fdecb4ed33ec1bb0d449f294c299d5369701,LANG-638,https://issues.apache.org/jira/browse/LANG-638 28,c0041cafc2fda3fb437009d5417ba5ebeb32ad35,bef3eb6ed060d5ae14da6ce5a1909675b8cf5650,LANG-617,https://issues.apache.org/jira/browse/LANG-617 diff --git a/framework/projects/Lang/compile-errors/test-1-10.diff b/framework/projects/Lang/compile-errors/test-1-10.diff new file mode 100644 index 000000000..6fe9a2012 --- /dev/null +++ b/framework/projects/Lang/compile-errors/test-1-10.diff @@ -0,0 +1,71 @@ +diff --git a/src/main/java/org/apache/commons/lang3/JavaVersion.java b/src/main/java/org/apache/commons/lang3/JavaVersion.java +index 0a34fea8f..40f8830c9 100644 +--- a/src/main/java/org/apache/commons/lang3/JavaVersion.java ++++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java +@@ -69,7 +69,17 @@ public enum JavaVersion { + /** + * Java 1.8. + */ +- JAVA_1_8(1.8f, "1.8"); ++ JAVA_1_8(1.8f, "1.8"), ++ ++ /** ++ * Java 1.9. ++ */ ++ JAVA_1_9(1.9f, "1.9"), ++ ++ /** ++ * Java 1.x, x > 9. Mainly introduced to avoid to break when a new version of Java is used. ++ */ ++ JAVA_RECENT(maxVersion(), Float.toString(maxVersion())); + + /** + * The float value. +@@ -147,9 +157,21 @@ static JavaVersion get(final String nom) { + return JAVA_1_7; + } else if ("1.8".equals(nom)) { + return JAVA_1_8; +- } else { ++ } else if ("1.9".equals(nom)) { ++ return JAVA_1_9; ++ } ++ if (nom == null) { + return null; + } ++ final float v = toFloatVersion(nom); ++ if ((v - 1.) < 1.) { // then we need to check decimals > .9 ++ final int firstComma = Math.max(nom.indexOf('.'), nom.indexOf(',')); ++ final int end = Math.max(nom.length(), nom.indexOf(',', firstComma)); ++ if (Float.parseFloat(nom.substring(firstComma + 1, end)) > .9f) { ++ return JAVA_RECENT; ++ } ++ } ++ return null; + } + + //----------------------------------------------------------------------- +@@ -165,4 +187,24 @@ public String toString() { + return name; + } + ++ // upper bound of java version considering 2. or current is the higher ++ private static float maxVersion() { ++ final float v = toFloatVersion(System.getProperty("java.version", "2.0")); ++ if (v > 0) { ++ return v; ++ } ++ return 2f; ++ } ++ ++ private static float toFloatVersion(final String name) { ++ final String[] toParse = name.split("\\."); ++ if (toParse.length >= 2) { ++ try { ++ return Float.parseFloat(toParse[0] + '.' + toParse[1]); ++ } catch (final NumberFormatException nfe) { ++ // no-op, let use default ++ } ++ } ++ return -1; ++ } + } diff --git a/framework/projects/Lang/compile-errors/test-1-4.diff b/framework/projects/Lang/compile-errors/test-1-4.diff new file mode 100644 index 000000000..96b1ff49f --- /dev/null +++ b/framework/projects/Lang/compile-errors/test-1-4.diff @@ -0,0 +1,12 @@ +index e65ba73f4..df52fc50f 100644 +--- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java ++++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java +@@ -521,7 +521,7 @@ public class TypeUtilsTest { + public void testTypesSatisfyVariables() throws SecurityException, NoSuchFieldException, + NoSuchMethodException { + final Map, Type> typeVarAssigns = new HashMap, Type>(); +- final Integer max = TypeUtilsTest.stub(); ++ final Integer max = TypeUtilsTest. stub(); + typeVarAssigns.put(getClass().getMethod("stub").getTypeParameters()[0], Integer.class); + Assert.assertTrue(TypeUtils.typesSatisfyVariables(typeVarAssigns)); + typeVarAssigns.clear(); diff --git a/framework/projects/Lang/compile-errors/test-14-16.diff b/framework/projects/Lang/compile-errors/test-14-16.diff new file mode 100644 index 000000000..6fe9a2012 --- /dev/null +++ b/framework/projects/Lang/compile-errors/test-14-16.diff @@ -0,0 +1,71 @@ +diff --git a/src/main/java/org/apache/commons/lang3/JavaVersion.java b/src/main/java/org/apache/commons/lang3/JavaVersion.java +index 0a34fea8f..40f8830c9 100644 +--- a/src/main/java/org/apache/commons/lang3/JavaVersion.java ++++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java +@@ -69,7 +69,17 @@ public enum JavaVersion { + /** + * Java 1.8. + */ +- JAVA_1_8(1.8f, "1.8"); ++ JAVA_1_8(1.8f, "1.8"), ++ ++ /** ++ * Java 1.9. ++ */ ++ JAVA_1_9(1.9f, "1.9"), ++ ++ /** ++ * Java 1.x, x > 9. Mainly introduced to avoid to break when a new version of Java is used. ++ */ ++ JAVA_RECENT(maxVersion(), Float.toString(maxVersion())); + + /** + * The float value. +@@ -147,9 +157,21 @@ static JavaVersion get(final String nom) { + return JAVA_1_7; + } else if ("1.8".equals(nom)) { + return JAVA_1_8; +- } else { ++ } else if ("1.9".equals(nom)) { ++ return JAVA_1_9; ++ } ++ if (nom == null) { + return null; + } ++ final float v = toFloatVersion(nom); ++ if ((v - 1.) < 1.) { // then we need to check decimals > .9 ++ final int firstComma = Math.max(nom.indexOf('.'), nom.indexOf(',')); ++ final int end = Math.max(nom.length(), nom.indexOf(',', firstComma)); ++ if (Float.parseFloat(nom.substring(firstComma + 1, end)) > .9f) { ++ return JAVA_RECENT; ++ } ++ } ++ return null; + } + + //----------------------------------------------------------------------- +@@ -165,4 +187,24 @@ public String toString() { + return name; + } + ++ // upper bound of java version considering 2. or current is the higher ++ private static float maxVersion() { ++ final float v = toFloatVersion(System.getProperty("java.version", "2.0")); ++ if (v > 0) { ++ return v; ++ } ++ return 2f; ++ } ++ ++ private static float toFloatVersion(final String name) { ++ final String[] toParse = name.split("\\."); ++ if (toParse.length >= 2) { ++ try { ++ return Float.parseFloat(toParse[0] + '.' + toParse[1]); ++ } catch (final NumberFormatException nfe) { ++ // no-op, let use default ++ } ++ } ++ return -1; ++ } + } diff --git a/framework/projects/Lang/compile-errors/test-17-20.diff b/framework/projects/Lang/compile-errors/test-17-20.diff new file mode 100644 index 000000000..0fc18cca3 --- /dev/null +++ b/framework/projects/Lang/compile-errors/test-17-20.diff @@ -0,0 +1,73 @@ +index 477495a4e..93e5bc142 100644 +--- a/src/main/java/org/apache/commons/lang3/JavaVersion.java ++++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java +@@ -36,7 +36,17 @@ public enum JavaVersion { + JAVA_1_5(1.5f, "1.5"), + JAVA_1_6(1.6f, "1.6"), + JAVA_1_7(1.7f, "1.7"), +- JAVA_1_8(1.8f, "1.8"); ++ JAVA_1_8(1.8f, "1.8"), ++ ++ /** ++ * Java 1.9. ++ */ ++ JAVA_1_9(1.9f, "1.9"), ++ ++ /** ++ * Java 1.x, x > 9. Mainly introduced to avoid to break when a new version of Java is used. ++ */ ++ JAVA_RECENT(maxVersion(), Float.toString(maxVersion())); + + /** + * The float value. +@@ -114,10 +124,22 @@ public enum JavaVersion { + return JAVA_1_7; + } else if ("1.8".equals(nom)) { + return JAVA_1_8; +- } else { ++ } else if ("1.9".equals(nom)) { ++ return JAVA_1_9; ++ } ++ if (nom == null) { + return null; + } +- } ++ final float v = toFloatVersion(nom); ++ if ((v - 1.) < 1.) { // then we need to check decimals > .9 ++ final int firstComma = Math.max(nom.indexOf('.'), nom.indexOf(',')); ++ final int end = Math.max(nom.length(), nom.indexOf(',', firstComma)); ++ if (Float.parseFloat(nom.substring(firstComma + 1, end)) > .9f) { ++ return JAVA_RECENT; ++ } ++ } ++ return null; ++ } + + //----------------------------------------------------------------------- + /** +@@ -132,4 +154,25 @@ public enum JavaVersion { + return name; + } + ++ // upper bound of java version considering 2. or current is the higher ++ private static float maxVersion() { ++ final float v = toFloatVersion(System.getProperty("java.version", "2.0")); ++ if (v > 0) { ++ return v; ++ } ++ return 2f; ++ } ++ ++ private static float toFloatVersion(final String name) { ++ final String[] toParse = name.split("\\."); ++ if (toParse.length >= 2) { ++ try { ++ return Float.parseFloat(toParse[0] + '.' + toParse[1]); ++ } catch (final NumberFormatException nfe) { ++ // no-op, let use default ++ } ++ } ++ return -1; ++ } ++ + } diff --git a/framework/projects/Lang/compile-errors/test-21-21.diff b/framework/projects/Lang/compile-errors/test-21-21.diff new file mode 100644 index 000000000..552f296d4 --- /dev/null +++ b/framework/projects/Lang/compile-errors/test-21-21.diff @@ -0,0 +1,67 @@ +diff --git a/src/main/java/org/apache/commons/lang3/JavaVersion.java b/src/main/java/org/apache/commons/lang3/JavaVersion.java +index b7c033ef4..ef3420c34 100644 +--- a/src/main/java/org/apache/commons/lang3/JavaVersion.java ++++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java +@@ -34,7 +34,17 @@ public enum JavaVersion { + JAVA_1_5(1.5f, "1.5"), + JAVA_1_6(1.6f, "1.6"), + JAVA_1_7(1.7f, "1.7"), +- JAVA_1_8(1.8f, "1.8"); ++ JAVA_1_8(1.8f, "1.8"), ++ ++ /** ++ * Java 1.9. ++ */ ++ JAVA_1_9(1.9f, "1.9"), ++ ++ /** ++ * Java 1.x, x > 9. Mainly introduced to avoid to break when a new version of Java is used. ++ */ ++ JAVA_RECENT(maxVersion(), Float.toString(maxVersion())); + + private float value; + private String name; +@@ -90,8 +100,42 @@ public enum JavaVersion { + } else + if("1.8".equals(nom)) { + return JAVA_1_8; +- } else { ++ } else if ("1.9".equals(nom)) { ++ return JAVA_1_9; ++ } ++ if (nom == null) { + return null; + } ++ final float v = toFloatVersion(nom); ++ if ((v - 1.) < 1.) { // then we need to check decimals > .9 ++ final int firstComma = Math.max(nom.indexOf('.'), nom.indexOf(',')); ++ final int end = Math.max(nom.length(), nom.indexOf(',', firstComma)); ++ if (Float.parseFloat(nom.substring(firstComma + 1, end)) > .9f) { ++ return JAVA_RECENT; ++ } ++ } ++ return null; + } ++ ++ // upper bound of java version considering 2. or current is the higher ++ private static float maxVersion() { ++ final float v = toFloatVersion(System.getProperty("java.version", "2.0")); ++ if (v > 0) { ++ return v; ++ } ++ return 2f; ++ } ++ ++ private static float toFloatVersion(final String name) { ++ final String[] toParse = name.split("\\."); ++ if (toParse.length >= 2) { ++ try { ++ return Float.parseFloat(toParse[0] + '.' + toParse[1]); ++ } catch (final NumberFormatException nfe) { ++ // no-op, let use default ++ } ++ } ++ return -1; ++ } ++ + } diff --git a/framework/projects/Lang/compile-errors/test-42-65.diff b/framework/projects/Lang/compile-errors/test-42-65.diff new file mode 100644 index 000000000..2cb2e66b4 --- /dev/null +++ b/framework/projects/Lang/compile-errors/test-42-65.diff @@ -0,0 +1,14 @@ +diff --git a/src/test/org/apache/commons/lang/AllLangTestSuite.java b/src/test/org/apache/commons/lang/AllLangTestSuite.java +index 9c572c3a9..e7b092ef3 100644 +--- a/src/test/org/apache/commons/lang/AllLangTestSuite.java ++++ b/src/test/org/apache/commons/lang/AllLangTestSuite.java +@@ -61,7 +61,7 @@ public class AllLangTestSuite extends TestCase { + suite.addTest(LangTestSuite.suite()); + suite.addTest(BuilderTestSuite.suite()); + suite.addTest(EnumTestSuite.suite()); +- suite.addTest(org.apache.commons.lang.enum.EnumTestSuite.suite()); ++ //suite.addTest(org.apache.commons.lang.enum.EnumTestSuite.suite()); + suite.addTest(ExceptionTestSuite.suite()); + suite.addTest(MathTestSuite.suite()); + suite.addTest(MutableTestSuite.suite()); + diff --git a/framework/projects/Lang/compile-errors/test-44-48.diff b/framework/projects/Lang/compile-errors/test-44-48.diff new file mode 100644 index 000000000..8938eb710 --- /dev/null +++ b/framework/projects/Lang/compile-errors/test-44-48.diff @@ -0,0 +1,19 @@ +index a1648aa11..afd166695 100644 +--- a/src/java/org/apache/commons/lang/builder/EqualsBuilder.java ++++ b/src/java/org/apache/commons/lang/builder/EqualsBuilder.java +@@ -377,12 +377,8 @@ public class EqualsBuilder { + } + Class lhsClass = lhs.getClass(); + if (!lhsClass.isArray()) { +- if (lhs instanceof java.math.BigDecimal) { +- isEquals = (((java.math.BigDecimal)lhs).compareTo(rhs) == 0); +- } else { +- // The simple case, not an array, just test the element +- isEquals = lhs.equals(rhs); +- } ++ // The simple case, not an array, just test the element ++ isEquals = lhs.equals(rhs); + } else if (lhs.getClass() != rhs.getClass()) { + // Here when we compare different dimensions, for example: a boolean[][] to a boolean[] + this.setEquals(false); + diff --git a/framework/projects/Lang/compile-errors/test-5-27.diff b/framework/projects/Lang/compile-errors/test-5-27.diff new file mode 100644 index 000000000..e1617f4cb --- /dev/null +++ b/framework/projects/Lang/compile-errors/test-5-27.diff @@ -0,0 +1,12 @@ +index 86465b180..af3e62677 100644 +--- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java ++++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java +@@ -511,7 +511,7 @@ public class TypeUtilsTest { + public void testTypesSatisfyVariables() throws SecurityException, NoSuchFieldException, + NoSuchMethodException { + Map, Type> typeVarAssigns = new HashMap, Type>(); +- Integer max = TypeUtilsTest.stub(); ++ Integer max = TypeUtilsTest. stub(); + typeVarAssigns.put(getClass().getMethod("stub").getTypeParameters()[0], Integer.class); + Assert.assertTrue(TypeUtils.typesSatisfyVariables(typeVarAssigns)); + typeVarAssigns.clear(); diff --git a/framework/projects/Lang/deprecated-bugs.csv b/framework/projects/Lang/deprecated-bugs.csv index 3bde3be90..05c2644e3 100644 --- a/framework/projects/Lang/deprecated-bugs.csv +++ b/framework/projects/Lang/deprecated-bugs.csv @@ -1,2 +1,3 @@ bug.id,revision.id.buggy,revision.id.fixed,report.id,report.url,deprecated.version,deprecated.reason 2,8b494b784dca4de7d79c58e0f00dd4756c04cf89,dcde57852a97a9ac8021d2440b3de5be4870ecf6,LANG-879,https://issues.apache.org/jira/browse/LANG-879,2.0.0,JVM8.Not.Reproducible +25,44dbf85b6a7156d550ba62210412015058336281,dd5f8ea30755268dc43bbf2cd5024412674eb1b0,LANG-658,https://issues.apache.org/jira/browse/LANG-658,3.0.0,JVM11.Not.Repoducible diff --git a/framework/projects/Lang/failing_tests/04babff3798680e012646988841bcc710a9e3c54 b/framework/projects/Lang/failing_tests/04babff3798680e012646988841bcc710a9e3c54 index 1ca77903d..be97c3319 100644 --- a/framework/projects/Lang/failing_tests/04babff3798680e012646988841bcc710a9e3c54 +++ b/framework/projects/Lang/failing_tests/04babff3798680e012646988841bcc710a9e3c54 @@ -1,4 +1,6 @@ ## commons-lang: 04babff3798680e012646988841bcc710a9e3c54 ## +--- org.apache.commons.lang3.time.DateUtilsTest::testLANG799_DE_OK +--- org.apache.commons.lang3.time.DateUtilsTest::testLANG799_EN_WITH_DE_LOCALE --- org.apache.commons.lang3.builder.ToStringBuilderTest::testReflectionHierarchyArrayList junit.framework.AssertionFailedError: expected:<...1774cf[elementData={[,,,,,,,,,]},size=0,modCount=0]> but was:<...1774cf[elementData={[]},size=0,modCount=0]> at org.junit.Assert.assertEquals(Assert.java:115) diff --git a/framework/projects/Lang/failing_tests/127e6e338f088b82eea1967d31c1abf8d51a364f b/framework/projects/Lang/failing_tests/127e6e338f088b82eea1967d31c1abf8d51a364f index e469a5943..d877a22e0 100644 --- a/framework/projects/Lang/failing_tests/127e6e338f088b82eea1967d31c1abf8d51a364f +++ b/framework/projects/Lang/failing_tests/127e6e338f088b82eea1967d31c1abf8d51a364f @@ -1,4 +1,5 @@ ## commons-lang: 127e6e338f088b82eea1967d31c1abf8d51a364f ## +--- org.apache.commons.lang.time.FastDateFormatTest::testShortDateStyleWithLocales --- org.apache.commons.lang.CharUtilsPerfTest java.lang.Exception: No runnable methods at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:169) diff --git a/framework/projects/Lang/failing_tests/14a0cc2a9baf84a97348263975082ef3857daf97 b/framework/projects/Lang/failing_tests/14a0cc2a9baf84a97348263975082ef3857daf97 index eca4dc4f3..7b13581a8 100644 --- a/framework/projects/Lang/failing_tests/14a0cc2a9baf84a97348263975082ef3857daf97 +++ b/framework/projects/Lang/failing_tests/14a0cc2a9baf84a97348263975082ef3857daf97 @@ -1,4 +1,5 @@ ## commons-lang: 14a0cc2a9baf84a97348263975082ef3857daf97 ## +--- org.apache.commons.lang3.time.FastDateFormatTest::testShortDateStyleWithLocales --- org.apache.commons.lang3.builder.ToStringBuilderTest::testReflectionHierarchyArrayList junit.framework.ComparisonFailure: expected:<...20e7e1[elementData={[,,,,,,,,,]},size=0,modCount=0]> but was:<...20e7e1[elementData={[]},size=0,modCount=0]> at junit.framework.Assert.assertEquals(Assert.java:100) diff --git a/framework/projects/Lang/failing_tests/1ced894df70d66f3a786c2c8cd6e23e0d4263d91 b/framework/projects/Lang/failing_tests/1ced894df70d66f3a786c2c8cd6e23e0d4263d91 index b00e9949d..be2f49cd6 100644 --- a/framework/projects/Lang/failing_tests/1ced894df70d66f3a786c2c8cd6e23e0d4263d91 +++ b/framework/projects/Lang/failing_tests/1ced894df70d66f3a786c2c8cd6e23e0d4263d91 @@ -1,4 +1,5 @@ ## commons-lang: 1ced894df70d66f3a786c2c8cd6e23e0d4263d91 ## +--- org.apache.commons.lang3.ClassUtilsTest::test_isAssignable --- org.apache.commons.lang3.builder.ToStringBuilderTest::testReflectionHierarchyArrayList junit.framework.ComparisonFailure: expected:<...67f451[elementData={[,,,,,,,,,]},size=0,modCount=0]> but was:<...67f451[elementData={[]},size=0,modCount=0]> at junit.framework.Assert.assertEquals(Assert.java:100) diff --git a/framework/projects/Lang/failing_tests/2dc56182579703153e5c9886b3ecd22bbc348b49 b/framework/projects/Lang/failing_tests/2dc56182579703153e5c9886b3ecd22bbc348b49 index ca770def0..bbdc10650 100644 --- a/framework/projects/Lang/failing_tests/2dc56182579703153e5c9886b3ecd22bbc348b49 +++ b/framework/projects/Lang/failing_tests/2dc56182579703153e5c9886b3ecd22bbc348b49 @@ -1,4 +1,6 @@ ## commons-lang: 2dc56182579703153e5c9886b3ecd22bbc348b49 ## +--- org.apache.commons.lang.exception.ExceptionUtilsTest::testIsNestedThrowable_Throwable +--- org.apache.commons.lang.exception.ExceptionUtilsTest::testIsThrowableNested --- org.apache.commons.lang.builder.ToStringBuilderTest::testReflectionHierarchyArrayList junit.framework.ComparisonFailure: expected:<...4f279c[elementData={[,,,,,,,,,]},size=0,modCount=0]> but was:<...4f279c[elementData={[]},size=0,modCount=0]> at junit.framework.Assert.assertEquals(Assert.java:100) diff --git a/framework/projects/Lang/failing_tests/2f8f67ab2939f1c23f09c8764e04ea2da0479332 b/framework/projects/Lang/failing_tests/2f8f67ab2939f1c23f09c8764e04ea2da0479332 index d3fc7bf51..6c08e1e34 100644 --- a/framework/projects/Lang/failing_tests/2f8f67ab2939f1c23f09c8764e04ea2da0479332 +++ b/framework/projects/Lang/failing_tests/2f8f67ab2939f1c23f09c8764e04ea2da0479332 @@ -1,4 +1,6 @@ ## commons-lang: 2f8f67ab2939f1c23f09c8764e04ea2da0479332 ## +--- org.apache.commons.lang3.exception.ExceptionUtilsTest::testIsNestedThrowable_Throwable +--- org.apache.commons.lang3.exception.ExceptionUtilsTest::testIsThrowableNested --- org.apache.commons.lang3.builder.ToStringBuilderTest::testReflectionHierarchyArrayList junit.framework.ComparisonFailure: expected:<...98e03e[elementData={[,,,,,,,,,]},size=0,modCount=0]> but was:<...98e03e[elementData={[]},size=0,modCount=0]> at junit.framework.Assert.assertEquals(Assert.java:100) diff --git a/framework/projects/Lang/failing_tests/34a6449c90a3b6074111a6bcbd31ad00ac1570f3 b/framework/projects/Lang/failing_tests/34a6449c90a3b6074111a6bcbd31ad00ac1570f3 index 4aaad54f3..cb7bb089c 100644 --- a/framework/projects/Lang/failing_tests/34a6449c90a3b6074111a6bcbd31ad00ac1570f3 +++ b/framework/projects/Lang/failing_tests/34a6449c90a3b6074111a6bcbd31ad00ac1570f3 @@ -1,4 +1,5 @@ ## commons-lang: 34a6449c90a3b6074111a6bcbd31ad00ac1570f3 ## +--- org.apache.commons.lang3.time.FastDateFormatTest::testShortDateStyleWithLocales --- org.apache.commons.lang3.builder.ToStringBuilderTest::testReflectionHierarchyArrayList junit.framework.ComparisonFailure: expected:<...572b88[elementData={[,,,,,,,,,]},size=0,modCount=0]> but was:<...572b88[elementData={[]},size=0,modCount=0]> at junit.framework.Assert.assertEquals(Assert.java:100) diff --git a/framework/projects/Lang/failing_tests/56550bf2779990da78d2bac1d8287c8a693c6e4b b/framework/projects/Lang/failing_tests/56550bf2779990da78d2bac1d8287c8a693c6e4b index 7ddd9e62c..0a7ce457a 100644 --- a/framework/projects/Lang/failing_tests/56550bf2779990da78d2bac1d8287c8a693c6e4b +++ b/framework/projects/Lang/failing_tests/56550bf2779990da78d2bac1d8287c8a693c6e4b @@ -1,4 +1,6 @@ ## commons-lang: 56550bf2779990da78d2bac1d8287c8a693c6e4b ## +--- org.apache.commons.lang3.exception.ExceptionUtilsTest::testIsNestedThrowable_Throwable +--- org.apache.commons.lang3.exception.ExceptionUtilsTest::testIsThrowableNested --- org.apache.commons.lang3.builder.ToStringBuilderTest::testReflectionHierarchyArrayList junit.framework.ComparisonFailure: expected:<...08705a[elementData={[,,,,,,,,,]},size=0,modCount=0]> but was:<...08705a[elementData={[]},size=0,modCount=0]> at junit.framework.Assert.assertEquals(Assert.java:100) diff --git a/framework/projects/Lang/failing_tests/65a6458eaa2e1f88278e4bb5753a68bd825e3a80 b/framework/projects/Lang/failing_tests/65a6458eaa2e1f88278e4bb5753a68bd825e3a80 index 0fc6c63e4..05371ac10 100644 --- a/framework/projects/Lang/failing_tests/65a6458eaa2e1f88278e4bb5753a68bd825e3a80 +++ b/framework/projects/Lang/failing_tests/65a6458eaa2e1f88278e4bb5753a68bd825e3a80 @@ -1,4 +1,6 @@ ## commons-lang: 65a6458eaa2e1f88278e4bb5753a68bd825e3a80 ## +--- org.apache.commons.lang3.time.DateUtilsTest::testLANG799_DE_OK +--- org.apache.commons.lang3.time.DateUtilsTest::testLANG799_EN_WITH_DE_LOCALE --- org.apache.commons.lang3.builder.ToStringBuilderTest::testReflectionHierarchyArrayList junit.framework.AssertionFailedError: expected:<...f5ed2a[elementData={[,,,,,,,,,]},size=0,modCount=0]> but was:<...f5ed2a[elementData={[]},size=0,modCount=0]> at org.junit.Assert.assertEquals(Assert.java:115) diff --git a/framework/projects/Lang/failing_tests/711e204e73f24e32acb3727a5d9d3b351b6639d1 b/framework/projects/Lang/failing_tests/711e204e73f24e32acb3727a5d9d3b351b6639d1 index 6115b73d7..f59d3b44a 100644 --- a/framework/projects/Lang/failing_tests/711e204e73f24e32acb3727a5d9d3b351b6639d1 +++ b/framework/projects/Lang/failing_tests/711e204e73f24e32acb3727a5d9d3b351b6639d1 @@ -1,4 +1,6 @@ ## commons-lang: 711e204e73f24e32acb3727a5d9d3b351b6639d1 ## +--- org.apache.commons.lang.exception.ExceptionUtilsTest::testIsNestedThrowable_Throwable +--- org.apache.commons.lang.exception.ExceptionUtilsTest::testIsThrowableNested --- org.apache.commons.lang.builder.ToStringBuilderTest::testReflectionHierarchyArrayList junit.framework.ComparisonFailure: expected:<...5a7dd3[elementData={[,,,,,,,,,]},size=0,modCount=0]> but was:<...5a7dd3[elementData={[]},size=0,modCount=0]> at junit.framework.Assert.assertEquals(Assert.java:100) diff --git a/framework/projects/Lang/failing_tests/75d931a3264b73caa9cdd7d3373375cc33008ddf b/framework/projects/Lang/failing_tests/75d931a3264b73caa9cdd7d3373375cc33008ddf index 92b0b3a21..5617b5471 100644 --- a/framework/projects/Lang/failing_tests/75d931a3264b73caa9cdd7d3373375cc33008ddf +++ b/framework/projects/Lang/failing_tests/75d931a3264b73caa9cdd7d3373375cc33008ddf @@ -1,4 +1,5 @@ ## commons-lang: 75d931a3264b73caa9cdd7d3373375cc33008ddf ## +--- org.apache.commons.lang.LocaleUtilsTest::testToLocale_3Part --- org.apache.commons.lang.CharUtilsPerfTest java.lang.Exception: No runnable methods at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:169) diff --git a/framework/projects/Lang/failing_tests/825481f019e4482e5ea74d5b0b5e5c438535cb68 b/framework/projects/Lang/failing_tests/825481f019e4482e5ea74d5b0b5e5c438535cb68 index ebfacfc56..472c99edf 100644 --- a/framework/projects/Lang/failing_tests/825481f019e4482e5ea74d5b0b5e5c438535cb68 +++ b/framework/projects/Lang/failing_tests/825481f019e4482e5ea74d5b0b5e5c438535cb68 @@ -1,4 +1,5 @@ ## commons-lang: 825481f019e4482e5ea74d5b0b5e5c438535cb68 ## +--- org.apache.commons.lang3.time.FastDateFormatTest::testShortDateStyleWithLocales --- org.apache.commons.lang3.builder.ToStringBuilderTest::testReflectionHierarchyArrayList junit.framework.ComparisonFailure: expected:<...d5da47[elementData={[,,,,,,,,,]},size=0,modCount=0]> but was:<...d5da47[elementData={[]},size=0,modCount=0]> at junit.framework.Assert.assertEquals(Assert.java:100) diff --git a/framework/projects/Lang/failing_tests/8f675dd3cbfb8f552bdbbe1cfc646ba5b367983b b/framework/projects/Lang/failing_tests/8f675dd3cbfb8f552bdbbe1cfc646ba5b367983b index 5deeea049..1dbc51220 100644 --- a/framework/projects/Lang/failing_tests/8f675dd3cbfb8f552bdbbe1cfc646ba5b367983b +++ b/framework/projects/Lang/failing_tests/8f675dd3cbfb8f552bdbbe1cfc646ba5b367983b @@ -1,4 +1,5 @@ ## commons-lang: 8f675dd3cbfb8f552bdbbe1cfc646ba5b367983b ## +--- org.apache.commons.lang3.ClassUtilsTest::test_isAssignable --- org.apache.commons.lang3.builder.ToStringBuilderTest::testReflectionHierarchyArrayList junit.framework.ComparisonFailure: expected:<...786a70[elementData={[,,,,,,,,,]},size=0,modCount=0]> but was:<...786a70[elementData={[]},size=0,modCount=0]> at junit.framework.Assert.assertEquals(Assert.java:100) diff --git a/framework/projects/Lang/failing_tests/ad72b9f2bf37bd61af18bde67c1622d90a5d8766 b/framework/projects/Lang/failing_tests/ad72b9f2bf37bd61af18bde67c1622d90a5d8766 index 0ad373086..af8d3ed77 100644 --- a/framework/projects/Lang/failing_tests/ad72b9f2bf37bd61af18bde67c1622d90a5d8766 +++ b/framework/projects/Lang/failing_tests/ad72b9f2bf37bd61af18bde67c1622d90a5d8766 @@ -1,4 +1,6 @@ ## commons-lang: ad72b9f2bf37bd61af18bde67c1622d90a5d8766 ## +--- org.apache.commons.lang3.time.DateUtilsTest::testLANG799_DE_OK +--- org.apache.commons.lang3.time.DateUtilsTest::testLANG799_EN_WITH_DE_LOCALE --- org.apache.commons.lang3.builder.ToStringBuilderTest::testReflectionHierarchyArrayList junit.framework.AssertionFailedError: expected:<...f5ed2a[elementData={[,,,,,,,,,]},size=0,modCount=0]> but was:<...f5ed2a[elementData={[]},size=0,modCount=0]> at org.junit.Assert.assertEquals(Assert.java:115) diff --git a/framework/projects/Lang/failing_tests/bc52782cd84f4356d2984e1aa01806f81754eb08 b/framework/projects/Lang/failing_tests/bc52782cd84f4356d2984e1aa01806f81754eb08 index d2abc4a63..30e74f4d3 100644 --- a/framework/projects/Lang/failing_tests/bc52782cd84f4356d2984e1aa01806f81754eb08 +++ b/framework/projects/Lang/failing_tests/bc52782cd84f4356d2984e1aa01806f81754eb08 @@ -1,4 +1,5 @@ ## commons-lang: bc52782cd84f4356d2984e1aa01806f81754eb08 ## +--- org.apache.commons.lang3.ClassUtilsTest::test_isAssignable --- org.apache.commons.lang3.builder.ToStringBuilderTest::testReflectionHierarchyArrayList junit.framework.ComparisonFailure: expected:<...f289ee[elementData={[,,,,,,,,,]},size=0,modCount=0]> but was:<...f289ee[elementData={[]},size=0,modCount=0]> at junit.framework.Assert.assertEquals(Assert.java:100) diff --git a/framework/projects/Lang/failing_tests/cf20d13c64da51becd1351befe02a06144fd6fc1 b/framework/projects/Lang/failing_tests/cf20d13c64da51becd1351befe02a06144fd6fc1 index 55f16e21a..9e52198c3 100644 --- a/framework/projects/Lang/failing_tests/cf20d13c64da51becd1351befe02a06144fd6fc1 +++ b/framework/projects/Lang/failing_tests/cf20d13c64da51becd1351befe02a06144fd6fc1 @@ -1,4 +1,6 @@ ## commons-lang: cf20d13c64da51becd1351befe02a06144fd6fc1 ## +--- org.apache.commons.lang.LocaleUtilsTest::testLanguagesByCountry +--- org.apache.commons.lang.LocaleUtilsTest::testToLocale_3Part --- org.apache.commons.lang.CharUtilsPerfTest java.lang.Exception: No runnable methods at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:169) diff --git a/framework/projects/Lang/failing_tests/e199d381f8c199801fee2d40a7f3ea1380700631 b/framework/projects/Lang/failing_tests/e199d381f8c199801fee2d40a7f3ea1380700631 index 3c2876879..4b2c27242 100644 --- a/framework/projects/Lang/failing_tests/e199d381f8c199801fee2d40a7f3ea1380700631 +++ b/framework/projects/Lang/failing_tests/e199d381f8c199801fee2d40a7f3ea1380700631 @@ -1,4 +1,5 @@ ## commons-lang: e199d381f8c199801fee2d40a7f3ea1380700631 ## +--- org.apache.commons.lang.builder.EqualsBuilderTest::testBigDecimal --- org.apache.commons.lang.CharUtilsPerfTest java.lang.Exception: No runnable methods at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:169) diff --git a/framework/projects/Lang/failing_tests/e9e167f9ebc7a73c5847745688ae127ecff6e2b1 b/framework/projects/Lang/failing_tests/e9e167f9ebc7a73c5847745688ae127ecff6e2b1 index 42fd515da..7a573527a 100644 --- a/framework/projects/Lang/failing_tests/e9e167f9ebc7a73c5847745688ae127ecff6e2b1 +++ b/framework/projects/Lang/failing_tests/e9e167f9ebc7a73c5847745688ae127ecff6e2b1 @@ -1,4 +1,5 @@ ## commons-lang: e9e167f9ebc7a73c5847745688ae127ecff6e2b1 ## +--- org.apache.commons.lang.time.FastDateFormatTest::testShortDateStyleWithLocales --- org.apache.commons.lang.CharUtilsPerfTest java.lang.Exception: No runnable methods at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:169) diff --git a/framework/projects/Lang/patches/48.src.patch b/framework/projects/Lang/patches/48.src.patch index 1919c2db5..a35f7a8df 100644 --- a/framework/projects/Lang/patches/48.src.patch +++ b/framework/projects/Lang/patches/48.src.patch @@ -2,16 +2,13 @@ diff --git a/src/java/org/apache/commons/lang/builder/EqualsBuilder.java b/src/j index 6901c8e..a783b35 100644 --- a/src/java/org/apache/commons/lang/builder/EqualsBuilder.java +++ b/src/java/org/apache/commons/lang/builder/EqualsBuilder.java -@@ -377,12 +377,8 @@ public class EqualsBuilder { +@@ -377,8 +377,8 @@ public class EqualsBuilder { } Class lhsClass = lhs.getClass(); if (!lhsClass.isArray()) { -- if (lhs instanceof java.math.BigDecimal) { -- isEquals = (((java.math.BigDecimal)lhs).compareTo(rhs) == 0); -- } else { - // The simple case, not an array, just test the element - isEquals = lhs.equals(rhs); -- } + // The simple case, not an array, just test the element +- isEquals = lhs.equals(rhs); ++ isEquals = lhs.equals(rhs); } else if (lhs.getClass() != rhs.getClass()) { // Here when we compare different dimensions, for example: a boolean[][] to a boolean[] this.setEquals(false); diff --git a/framework/test/test_verify_bugs.sh b/framework/test/test_verify_bugs.sh index 896abe0f1..03e6aa4df 100755 --- a/framework/test/test_verify_bugs.sh +++ b/framework/test/test_verify_bugs.sh @@ -146,6 +146,10 @@ for bid in $(echo $BUGS); do sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/gson/maven-build.xml ;; Lang) + # either this + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml + # or this sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties ;; Math) diff --git a/framework/test/test_verify_bugs.sh.Debug b/framework/test/test_verify_bugs.sh.Debug new file mode 100755 index 000000000..9375573e7 --- /dev/null +++ b/framework/test/test_verify_bugs.sh.Debug @@ -0,0 +1,203 @@ +#!/usr/bin/env bash +################################################################################ +# +# This script verifies that all bugs for a given project are reproducible and +# that the provided information about triggering tests is correct. +# This script must be run from its own directory (`framework/tests/`). +# +# By default, this script runs only relevant tests. Set the -A flag to run all +# tests. Set the -D flag to enable verbose logging (D4J_DEBUG). +# +# Examples for Lang: +# * Verify all bugs: ./test_verify_bugs.sh -pLang +# * Verify bugs 1-10: ./test_verify_bugs.sh -pLang -b1..10 +# * Verify bugs 1 and 3: ./test_verify_bugs.sh -pLang -b1 -b3 +# * Verify bugs 1-10 and 20: ./test_verify_bugs.sh -pLang -b1..10 -b20 +# * Verify bug 2 with DEBUG ./test_verify_bugs.sh -pLang -b 2 -D +# +################################################################################ +# Import helper subroutines and variables, and init Defects4J +source test.include + +TEST_DIR=`pwd` + +# Print usage message and exit +usage() { + local known_pids=$(defects4j pids) + echo "usage: $0 -p [-b ... | -b ... ] [-D]" + echo "Project ids:" + for pid in $known_pids; do + echo " * $pid" + done + exit 1 +} + +# Run only relevant tests by default +TEST_FLAG="-r" +# Debugging is off by default +DEBUG="" + +# Check arguments +while getopts ":p:b:AD" opt; do + case $opt in + A) TEST_FLAG="" + ;; + D) DEBUG="-D" + ;; + p) PID="$OPTARG" + ;; + b) if [[ "$OPTARG" =~ ^[0-9]*\.\.[0-9]*$ ]]; then + BUGS="$BUGS $(eval echo {$OPTARG})" + else + BUGS="$BUGS $OPTARG" + fi + ;; + \?) + echo "Unknown option: -$OPTARG" >&2 + usage + ;; + :) + echo "No argument provided: -$OPTARG." >&2 + usage + ;; + esac +done + +if [ "$PID" == "" ]; then + usage +fi + +if [ ! -e "$BASE_DIR/framework/core/Project/$PID.pm" ]; then + usage +fi + +# Run all bugs, unless otherwise specified +if [ "$BUGS" == "" ]; then + BUGS="$(get_bug_ids $BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE)" +fi + +if [ "$DEBUG" == "-D" ]; then + export D4J_DEBUG=1 +fi + +init + +# Create log file +script_name=$(echo $script | sed 's/\.sh$//') +LOG="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).log" +DIR_FAILING="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).failing_tests" + +################################################################################ +# Run developer-written tests on all buggy and fixed program versions, and +# verify trigger tests +################################################################################ + +# Reproduce all bugs (and log all results), regardless of whether errors occur +HALT_ON_ERROR=0 + +test_dir="$TMP_DIR/test_trigger" +mkdir -p $test_dir + +mkdir -p $DIR_FAILING + +work_dir="$test_dir/$PID" + +function sed_cmd() +{ + if [ $(uname -s) = "Darwin" ]; then + sed -i '' $1 $2 + else + sed -i $1 $2 + fi +} + +# Clean working directory +rm -rf $work_dir +for bid in $(echo $BUGS); do + # Skip all bug ids that do not exist in the active-bugs csv + if ! grep -q "^$bid," "$BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE"; then + warn "Skipping bug ID that is not listed in active-bugs csv: $PID-$bid" + continue + fi + + for v in "b" "f"; do + vid=${bid}$v + defects4j checkout -p $PID -v "$vid" -w "$work_dir" || die "checkout: $PID-$vid" + case $PID in + Cli|Time) + # doesn't always exist + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml + # only used when no maven-build.xml + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/build.xml + ;; + Closure) + sed_cmd "s/target-jvm: 1\.[1-5]/target-jvm 1.6/" $work_dir/lib/rhino/build.properties + sed_cmd "s/source-level: 1\.[1-5]/source-level 1.6/" $work_dir/lib/rhino/build.properties + ;; + Codec) + sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties + ;; + Compress|Csv|Jsoup) + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml + ;; + Gson) + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/gson/maven-build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/gson/maven-build.xml + ;; + Lang) + # either this + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml + # or this + sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties + ;; + Math) + sed_cmd "s/value=\"1\.[1-5]\"/value=\"1.6\"/" $work_dir/build.xml + ;; + esac + defects4j compile -w "$work_dir" || die "compile: $PID-$vid" + defects4j test $TEST_FLAG -w "$work_dir" || die "run relevant tests: $PID-$vid" + + cat "$work_dir/failing_tests" > "$DIR_FAILING/$vid" + + triggers=$(num_triggers "$work_dir/failing_tests") + # Expected number of failing tests for each fixed version is 0! + if [ $v == "f" ]; then + [ $triggers -eq 0 ] \ + || die "verify number of triggering tests: $PID-$vid (expected: 0, actual: $triggers)" + continue + fi + + # Expected number of failing tests for each buggy version is equal + # to the number of provided triggering tests + expected=$(num_triggers "$BASE_DIR/framework/projects/$PID/trigger_tests/$bid") + + # Fail if there are no trigger tests + [ $expected -gt 0 ] || die "Metadata error: There are no trigger tests for $PID-$vid" + + [ $triggers -eq $expected ] \ + || die "verify number of triggering tests: $PID-$vid (expected: $expected, actual: $triggers)" + for t in $(get_triggers "$BASE_DIR/framework/projects/$PID/trigger_tests/$bid"); do + grep -q "$t" "$work_dir/failing_tests" || die "expected triggering test $t did not fail" + done + done +done + +if [ "$DEBUG" != "-D" ]; then + rm -rf $TMP_DIR +fi +HALT_ON_ERROR=1 + +# Print a summary of what went wrong +if [ $ERROR != 0 ]; then + printf '=%.s' $(seq 1 80) 1>&2 + echo 1>&2 + echo "The following errors occurred:" 1>&2 + cat $LOG 1>&2 +fi + +# Indicate whether an error occurred +exit $ERROR diff --git a/framework/test/test_verify_bugs.sh.Lang b/framework/test/test_verify_bugs.sh.Lang new file mode 100755 index 000000000..03e6aa4df --- /dev/null +++ b/framework/test/test_verify_bugs.sh.Lang @@ -0,0 +1,201 @@ +#!/usr/bin/env bash +################################################################################ +# +# This script verifies that all bugs for a given project are reproducible and +# that the provided information about triggering tests is correct. +# This script must be run from its own directory (`framework/tests/`). +# +# By default, this script runs only relevant tests. Set the -A flag to run all +# tests. Set the -D flag to enable verbose logging (D4J_DEBUG). +# +# Examples for Lang: +# * Verify all bugs: ./test_verify_bugs.sh -pLang +# * Verify bugs 1-10: ./test_verify_bugs.sh -pLang -b1..10 +# * Verify bugs 1 and 3: ./test_verify_bugs.sh -pLang -b1 -b3 +# * Verify bugs 1-10 and 20: ./test_verify_bugs.sh -pLang -b1..10 -b20 +# * Verify bug 2 with DEBUG ./test_verify_bugs.sh -pLang -b 2 -D +# +################################################################################ +# Import helper subroutines and variables, and init Defects4J +source test.include + +# Print usage message and exit +usage() { + local known_pids=$(defects4j pids) + echo "usage: $0 -p [-b ... | -b ... ] [-D]" + echo "Project ids:" + for pid in $known_pids; do + echo " * $pid" + done + exit 1 +} + +# Run only relevant tests by default +TEST_FLAG="-r" +# Debugging is off by default +DEBUG="" + +# Check arguments +while getopts ":p:b:AD" opt; do + case $opt in + A) TEST_FLAG="" + ;; + D) DEBUG="-D" + ;; + p) PID="$OPTARG" + ;; + b) if [[ "$OPTARG" =~ ^[0-9]*\.\.[0-9]*$ ]]; then + BUGS="$BUGS $(eval echo {$OPTARG})" + else + BUGS="$BUGS $OPTARG" + fi + ;; + \?) + echo "Unknown option: -$OPTARG" >&2 + usage + ;; + :) + echo "No argument provided: -$OPTARG." >&2 + usage + ;; + esac +done + +if [ "$PID" == "" ]; then + usage +fi + +if [ ! -e "$BASE_DIR/framework/core/Project/$PID.pm" ]; then + usage +fi + +init + +# Run all bugs, unless otherwise specified +if [ "$BUGS" == "" ]; then + BUGS="$(get_bug_ids $BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE)" +fi + +if [ "$DEBUG" == "-D" ]; then + export D4J_DEBUG=1 +fi + +# Create log file +script_name=$(echo $script | sed 's/\.sh$//') +LOG="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).log" +DIR_FAILING="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).failing_tests" + +################################################################################ +# Run developer-written tests on all buggy and fixed program versions, and +# verify trigger tests +################################################################################ + +# Reproduce all bugs (and log all results), regardless of whether errors occur +HALT_ON_ERROR=0 + +test_dir="$TMP_DIR/test_trigger" +mkdir -p $test_dir + +mkdir -p $DIR_FAILING + +work_dir="$test_dir/$PID" + +function sed_cmd() +{ + if [ $(uname -s) = "Darwin" ]; then + sed -i '' $1 $2 + else + sed -i $1 $2 + fi +} + +# Clean working directory +rm -rf $work_dir +for bid in $(echo $BUGS); do + # Skip all bug ids that do not exist in the active-bugs csv + if ! grep -q "^$bid," "$BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE"; then + warn "Skipping bug ID that is not listed in active-bugs csv: $PID-$bid" + continue + fi + + for v in "b" "f"; do + vid=${bid}$v + defects4j checkout -p $PID -v "$vid" -w "$work_dir" || die "checkout: $PID-$vid" + case $PID in + Cli|Time) + # doesn't always exist + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml + # only used when no maven-build.xml + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/build.xml + ;; + Closure) + sed_cmd "s/target-jvm: 1\.[1-5]/target-jvm 1.6/" $work_dir/lib/rhino/build.properties + sed_cmd "s/source-level: 1\.[1-5]/source-level 1.6/" $work_dir/lib/rhino/build.properties + ;; + Codec) + sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties + ;; + Compress|Csv|Jsoup) + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml + ;; + Gson) + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/gson/maven-build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/gson/maven-build.xml + ;; + Lang) + # either this + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml + # or this + sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties + ;; + Math) + sed_cmd "s/value=\"1\.[1-5]\"/value=\"1.6\"/" $work_dir/build.xml + ;; + esac + defects4j compile -w "$work_dir" || die "compile: $PID-$vid" + defects4j test $TEST_FLAG -w "$work_dir" || die "run relevant tests: $PID-$vid" + + cat "$work_dir/failing_tests" > "$DIR_FAILING/$vid" + + triggers=$(num_triggers "$work_dir/failing_tests") + # Expected number of failing tests for each fixed version is 0! + if [ $v == "f" ]; then + [ $triggers -eq 0 ] \ + || die "verify number of triggering tests: $PID-$vid (expected: 0, actual: $triggers)" + continue + fi + + # Expected number of failing tests for each buggy version is equal + # to the number of provided triggering tests + expected=$(num_triggers "$BASE_DIR/framework/projects/$PID/trigger_tests/$bid") + + # Fail if there are no trigger tests + [ $expected -gt 0 ] || die "Metadata error: There are no trigger tests for $PID-$vid" + + [ $triggers -eq $expected ] \ + || die "verify number of triggering tests: $PID-$vid (expected: $expected, actual: $triggers)" + for t in $(get_triggers "$BASE_DIR/framework/projects/$PID/trigger_tests/$bid"); do + grep -q "$t" "$work_dir/failing_tests" || die "expected triggering test $t did not fail" + done + done +done + +if [ "$DEBUG" != "-D" ]; then + rm -rf $TMP_DIR +fi +HALT_ON_ERROR=1 + +# Print a summary of what went wrong +if [ $ERROR != 0 ]; then + printf '=%.s' $(seq 1 80) 1>&2 + echo 1>&2 + echo "The following errors occurred:" 1>&2 + cat $LOG 1>&2 +fi + +# Indicate whether an error occurred +exit $ERROR diff --git a/framework/test/test_verify_bugs.sh.orig b/framework/test/test_verify_bugs.sh.orig new file mode 100755 index 000000000..896abe0f1 --- /dev/null +++ b/framework/test/test_verify_bugs.sh.orig @@ -0,0 +1,197 @@ +#!/usr/bin/env bash +################################################################################ +# +# This script verifies that all bugs for a given project are reproducible and +# that the provided information about triggering tests is correct. +# This script must be run from its own directory (`framework/tests/`). +# +# By default, this script runs only relevant tests. Set the -A flag to run all +# tests. Set the -D flag to enable verbose logging (D4J_DEBUG). +# +# Examples for Lang: +# * Verify all bugs: ./test_verify_bugs.sh -pLang +# * Verify bugs 1-10: ./test_verify_bugs.sh -pLang -b1..10 +# * Verify bugs 1 and 3: ./test_verify_bugs.sh -pLang -b1 -b3 +# * Verify bugs 1-10 and 20: ./test_verify_bugs.sh -pLang -b1..10 -b20 +# * Verify bug 2 with DEBUG ./test_verify_bugs.sh -pLang -b 2 -D +# +################################################################################ +# Import helper subroutines and variables, and init Defects4J +source test.include + +# Print usage message and exit +usage() { + local known_pids=$(defects4j pids) + echo "usage: $0 -p [-b ... | -b ... ] [-D]" + echo "Project ids:" + for pid in $known_pids; do + echo " * $pid" + done + exit 1 +} + +# Run only relevant tests by default +TEST_FLAG="-r" +# Debugging is off by default +DEBUG="" + +# Check arguments +while getopts ":p:b:AD" opt; do + case $opt in + A) TEST_FLAG="" + ;; + D) DEBUG="-D" + ;; + p) PID="$OPTARG" + ;; + b) if [[ "$OPTARG" =~ ^[0-9]*\.\.[0-9]*$ ]]; then + BUGS="$BUGS $(eval echo {$OPTARG})" + else + BUGS="$BUGS $OPTARG" + fi + ;; + \?) + echo "Unknown option: -$OPTARG" >&2 + usage + ;; + :) + echo "No argument provided: -$OPTARG." >&2 + usage + ;; + esac +done + +if [ "$PID" == "" ]; then + usage +fi + +if [ ! -e "$BASE_DIR/framework/core/Project/$PID.pm" ]; then + usage +fi + +init + +# Run all bugs, unless otherwise specified +if [ "$BUGS" == "" ]; then + BUGS="$(get_bug_ids $BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE)" +fi + +if [ "$DEBUG" == "-D" ]; then + export D4J_DEBUG=1 +fi + +# Create log file +script_name=$(echo $script | sed 's/\.sh$//') +LOG="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).log" +DIR_FAILING="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).failing_tests" + +################################################################################ +# Run developer-written tests on all buggy and fixed program versions, and +# verify trigger tests +################################################################################ + +# Reproduce all bugs (and log all results), regardless of whether errors occur +HALT_ON_ERROR=0 + +test_dir="$TMP_DIR/test_trigger" +mkdir -p $test_dir + +mkdir -p $DIR_FAILING + +work_dir="$test_dir/$PID" + +function sed_cmd() +{ + if [ $(uname -s) = "Darwin" ]; then + sed -i '' $1 $2 + else + sed -i $1 $2 + fi +} + +# Clean working directory +rm -rf $work_dir +for bid in $(echo $BUGS); do + # Skip all bug ids that do not exist in the active-bugs csv + if ! grep -q "^$bid," "$BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE"; then + warn "Skipping bug ID that is not listed in active-bugs csv: $PID-$bid" + continue + fi + + for v in "b" "f"; do + vid=${bid}$v + defects4j checkout -p $PID -v "$vid" -w "$work_dir" || die "checkout: $PID-$vid" + case $PID in + Cli|Time) + # doesn't always exist + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml + # only used when no maven-build.xml + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/build.xml + ;; + Closure) + sed_cmd "s/target-jvm: 1\.[1-5]/target-jvm 1.6/" $work_dir/lib/rhino/build.properties + sed_cmd "s/source-level: 1\.[1-5]/source-level 1.6/" $work_dir/lib/rhino/build.properties + ;; + Codec) + sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties + ;; + Compress|Csv|Jsoup) + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml + ;; + Gson) + sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/gson/maven-build.xml + sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/gson/maven-build.xml + ;; + Lang) + sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties + ;; + Math) + sed_cmd "s/value=\"1\.[1-5]\"/value=\"1.6\"/" $work_dir/build.xml + ;; + esac + defects4j compile -w "$work_dir" || die "compile: $PID-$vid" + defects4j test $TEST_FLAG -w "$work_dir" || die "run relevant tests: $PID-$vid" + + cat "$work_dir/failing_tests" > "$DIR_FAILING/$vid" + + triggers=$(num_triggers "$work_dir/failing_tests") + # Expected number of failing tests for each fixed version is 0! + if [ $v == "f" ]; then + [ $triggers -eq 0 ] \ + || die "verify number of triggering tests: $PID-$vid (expected: 0, actual: $triggers)" + continue + fi + + # Expected number of failing tests for each buggy version is equal + # to the number of provided triggering tests + expected=$(num_triggers "$BASE_DIR/framework/projects/$PID/trigger_tests/$bid") + + # Fail if there are no trigger tests + [ $expected -gt 0 ] || die "Metadata error: There are no trigger tests for $PID-$vid" + + [ $triggers -eq $expected ] \ + || die "verify number of triggering tests: $PID-$vid (expected: $expected, actual: $triggers)" + for t in $(get_triggers "$BASE_DIR/framework/projects/$PID/trigger_tests/$bid"); do + grep -q "$t" "$work_dir/failing_tests" || die "expected triggering test $t did not fail" + done + done +done + +if [ "$DEBUG" != "-D" ]; then + rm -rf $TMP_DIR +fi +HALT_ON_ERROR=1 + +# Print a summary of what went wrong +if [ $ERROR != 0 ]; then + printf '=%.s' $(seq 1 80) 1>&2 + echo 1>&2 + echo "The following errors occurred:" 1>&2 + cat $LOG 1>&2 +fi + +# Indicate whether an error occurred +exit $ERROR From 4b78549896398324679916cd849f6d6ff6ab1b82 Mon Sep 17 00:00:00 2001 From: Mark Roberts Date: Thu, 26 Oct 2023 14:07:19 -0700 Subject: [PATCH 2/4] bid 48 no longer fails with Java 11 --- framework/projects/Lang/active-bugs.csv | 1 - framework/projects/Lang/deprecated-bugs.csv | 1 + .../Lang/failing_tests/e199d381f8c199801fee2d40a7f3ea1380700631 | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/framework/projects/Lang/active-bugs.csv b/framework/projects/Lang/active-bugs.csv index 22f420389..7861c724c 100644 --- a/framework/projects/Lang/active-bugs.csv +++ b/framework/projects/Lang/active-bugs.csv @@ -44,7 +44,6 @@ bug.id,revision.id.buggy,revision.id.fixed,report.id,report.url 45,04f767b393b5849185f4ddf8f7ae8fc0b255e9bf,4342bd5d69d122a16c735416039b4b2ca27897ad,LANG-419,https://issues.apache.org/jira/browse/LANG-419 46,65b5dc69db3bfd08b4392dcee16fa0542b097812,dd0deed066e728d7b09e5fd69855c5ad7bf6bdb4,LANG-421,https://issues.apache.org/jira/browse/LANG-421 47,2e8e3f46ba0a41d95c38875cf6a7153816262123,1fe5439baf32af2114958e3cfc3512bd72c84773,LANG-412,https://issues.apache.org/jira/browse/LANG-412 -48,97f1c120c092916f2f95439b6440a8977c66ee0a,e199d381f8c199801fee2d40a7f3ea1380700631,LANG-393,https://issues.apache.org/jira/browse/LANG-393 49,dab1bdfc0fec1d45def7d4e4870dc207bd954686,673385b43d0d5783039242460ba1c12b3f1f4e92,LANG-380,https://issues.apache.org/jira/browse/LANG-380 50,43cf3f491e7b9b42dc4a5fa4d7bc00cef1d38f7e,127e6e338f088b82eea1967d31c1abf8d51a364f,LANG-368,https://issues.apache.org/jira/browse/LANG-368 51,9da40ba6b5bcc7b6071fa7fe11eaeb1b97e53d81,796b898281af571a510d96487dcd95699ac1e435,LANG-365,https://issues.apache.org/jira/browse/LANG-365 diff --git a/framework/projects/Lang/deprecated-bugs.csv b/framework/projects/Lang/deprecated-bugs.csv index 05c2644e3..f362b0752 100644 --- a/framework/projects/Lang/deprecated-bugs.csv +++ b/framework/projects/Lang/deprecated-bugs.csv @@ -1,3 +1,4 @@ bug.id,revision.id.buggy,revision.id.fixed,report.id,report.url,deprecated.version,deprecated.reason 2,8b494b784dca4de7d79c58e0f00dd4756c04cf89,dcde57852a97a9ac8021d2440b3de5be4870ecf6,LANG-879,https://issues.apache.org/jira/browse/LANG-879,2.0.0,JVM8.Not.Reproducible 25,44dbf85b6a7156d550ba62210412015058336281,dd5f8ea30755268dc43bbf2cd5024412674eb1b0,LANG-658,https://issues.apache.org/jira/browse/LANG-658,3.0.0,JVM11.Not.Repoducible +48,97f1c120c092916f2f95439b6440a8977c66ee0a,e199d381f8c199801fee2d40a7f3ea1380700631,LANG-393,https://issues.apache.org/jira/browse/LANG-393,3.0.0,JVM11.Not.Repoducible diff --git a/framework/projects/Lang/failing_tests/e199d381f8c199801fee2d40a7f3ea1380700631 b/framework/projects/Lang/failing_tests/e199d381f8c199801fee2d40a7f3ea1380700631 index 4b2c27242..3c2876879 100644 --- a/framework/projects/Lang/failing_tests/e199d381f8c199801fee2d40a7f3ea1380700631 +++ b/framework/projects/Lang/failing_tests/e199d381f8c199801fee2d40a7f3ea1380700631 @@ -1,5 +1,4 @@ ## commons-lang: e199d381f8c199801fee2d40a7f3ea1380700631 ## ---- org.apache.commons.lang.builder.EqualsBuilderTest::testBigDecimal --- org.apache.commons.lang.CharUtilsPerfTest java.lang.Exception: No runnable methods at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:169) From a37f8be377c7f22c639c42eb176490b45b818916 Mon Sep 17 00:00:00 2001 From: Mark Roberts Date: Thu, 26 Oct 2023 14:12:11 -0700 Subject: [PATCH 3/4] remove debugging files checked in by accident --- framework/test/test_verify_bugs.sh.Debug | 203 ----------------------- framework/test/test_verify_bugs.sh.Lang | 201 ---------------------- framework/test/test_verify_bugs.sh.orig | 197 ---------------------- 3 files changed, 601 deletions(-) delete mode 100755 framework/test/test_verify_bugs.sh.Debug delete mode 100755 framework/test/test_verify_bugs.sh.Lang delete mode 100755 framework/test/test_verify_bugs.sh.orig diff --git a/framework/test/test_verify_bugs.sh.Debug b/framework/test/test_verify_bugs.sh.Debug deleted file mode 100755 index 9375573e7..000000000 --- a/framework/test/test_verify_bugs.sh.Debug +++ /dev/null @@ -1,203 +0,0 @@ -#!/usr/bin/env bash -################################################################################ -# -# This script verifies that all bugs for a given project are reproducible and -# that the provided information about triggering tests is correct. -# This script must be run from its own directory (`framework/tests/`). -# -# By default, this script runs only relevant tests. Set the -A flag to run all -# tests. Set the -D flag to enable verbose logging (D4J_DEBUG). -# -# Examples for Lang: -# * Verify all bugs: ./test_verify_bugs.sh -pLang -# * Verify bugs 1-10: ./test_verify_bugs.sh -pLang -b1..10 -# * Verify bugs 1 and 3: ./test_verify_bugs.sh -pLang -b1 -b3 -# * Verify bugs 1-10 and 20: ./test_verify_bugs.sh -pLang -b1..10 -b20 -# * Verify bug 2 with DEBUG ./test_verify_bugs.sh -pLang -b 2 -D -# -################################################################################ -# Import helper subroutines and variables, and init Defects4J -source test.include - -TEST_DIR=`pwd` - -# Print usage message and exit -usage() { - local known_pids=$(defects4j pids) - echo "usage: $0 -p [-b ... | -b ... ] [-D]" - echo "Project ids:" - for pid in $known_pids; do - echo " * $pid" - done - exit 1 -} - -# Run only relevant tests by default -TEST_FLAG="-r" -# Debugging is off by default -DEBUG="" - -# Check arguments -while getopts ":p:b:AD" opt; do - case $opt in - A) TEST_FLAG="" - ;; - D) DEBUG="-D" - ;; - p) PID="$OPTARG" - ;; - b) if [[ "$OPTARG" =~ ^[0-9]*\.\.[0-9]*$ ]]; then - BUGS="$BUGS $(eval echo {$OPTARG})" - else - BUGS="$BUGS $OPTARG" - fi - ;; - \?) - echo "Unknown option: -$OPTARG" >&2 - usage - ;; - :) - echo "No argument provided: -$OPTARG." >&2 - usage - ;; - esac -done - -if [ "$PID" == "" ]; then - usage -fi - -if [ ! -e "$BASE_DIR/framework/core/Project/$PID.pm" ]; then - usage -fi - -# Run all bugs, unless otherwise specified -if [ "$BUGS" == "" ]; then - BUGS="$(get_bug_ids $BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE)" -fi - -if [ "$DEBUG" == "-D" ]; then - export D4J_DEBUG=1 -fi - -init - -# Create log file -script_name=$(echo $script | sed 's/\.sh$//') -LOG="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).log" -DIR_FAILING="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).failing_tests" - -################################################################################ -# Run developer-written tests on all buggy and fixed program versions, and -# verify trigger tests -################################################################################ - -# Reproduce all bugs (and log all results), regardless of whether errors occur -HALT_ON_ERROR=0 - -test_dir="$TMP_DIR/test_trigger" -mkdir -p $test_dir - -mkdir -p $DIR_FAILING - -work_dir="$test_dir/$PID" - -function sed_cmd() -{ - if [ $(uname -s) = "Darwin" ]; then - sed -i '' $1 $2 - else - sed -i $1 $2 - fi -} - -# Clean working directory -rm -rf $work_dir -for bid in $(echo $BUGS); do - # Skip all bug ids that do not exist in the active-bugs csv - if ! grep -q "^$bid," "$BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE"; then - warn "Skipping bug ID that is not listed in active-bugs csv: $PID-$bid" - continue - fi - - for v in "b" "f"; do - vid=${bid}$v - defects4j checkout -p $PID -v "$vid" -w "$work_dir" || die "checkout: $PID-$vid" - case $PID in - Cli|Time) - # doesn't always exist - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml - # only used when no maven-build.xml - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/build.xml - ;; - Closure) - sed_cmd "s/target-jvm: 1\.[1-5]/target-jvm 1.6/" $work_dir/lib/rhino/build.properties - sed_cmd "s/source-level: 1\.[1-5]/source-level 1.6/" $work_dir/lib/rhino/build.properties - ;; - Codec) - sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties - ;; - Compress|Csv|Jsoup) - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml - ;; - Gson) - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/gson/maven-build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/gson/maven-build.xml - ;; - Lang) - # either this - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml - # or this - sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties - ;; - Math) - sed_cmd "s/value=\"1\.[1-5]\"/value=\"1.6\"/" $work_dir/build.xml - ;; - esac - defects4j compile -w "$work_dir" || die "compile: $PID-$vid" - defects4j test $TEST_FLAG -w "$work_dir" || die "run relevant tests: $PID-$vid" - - cat "$work_dir/failing_tests" > "$DIR_FAILING/$vid" - - triggers=$(num_triggers "$work_dir/failing_tests") - # Expected number of failing tests for each fixed version is 0! - if [ $v == "f" ]; then - [ $triggers -eq 0 ] \ - || die "verify number of triggering tests: $PID-$vid (expected: 0, actual: $triggers)" - continue - fi - - # Expected number of failing tests for each buggy version is equal - # to the number of provided triggering tests - expected=$(num_triggers "$BASE_DIR/framework/projects/$PID/trigger_tests/$bid") - - # Fail if there are no trigger tests - [ $expected -gt 0 ] || die "Metadata error: There are no trigger tests for $PID-$vid" - - [ $triggers -eq $expected ] \ - || die "verify number of triggering tests: $PID-$vid (expected: $expected, actual: $triggers)" - for t in $(get_triggers "$BASE_DIR/framework/projects/$PID/trigger_tests/$bid"); do - grep -q "$t" "$work_dir/failing_tests" || die "expected triggering test $t did not fail" - done - done -done - -if [ "$DEBUG" != "-D" ]; then - rm -rf $TMP_DIR -fi -HALT_ON_ERROR=1 - -# Print a summary of what went wrong -if [ $ERROR != 0 ]; then - printf '=%.s' $(seq 1 80) 1>&2 - echo 1>&2 - echo "The following errors occurred:" 1>&2 - cat $LOG 1>&2 -fi - -# Indicate whether an error occurred -exit $ERROR diff --git a/framework/test/test_verify_bugs.sh.Lang b/framework/test/test_verify_bugs.sh.Lang deleted file mode 100755 index 03e6aa4df..000000000 --- a/framework/test/test_verify_bugs.sh.Lang +++ /dev/null @@ -1,201 +0,0 @@ -#!/usr/bin/env bash -################################################################################ -# -# This script verifies that all bugs for a given project are reproducible and -# that the provided information about triggering tests is correct. -# This script must be run from its own directory (`framework/tests/`). -# -# By default, this script runs only relevant tests. Set the -A flag to run all -# tests. Set the -D flag to enable verbose logging (D4J_DEBUG). -# -# Examples for Lang: -# * Verify all bugs: ./test_verify_bugs.sh -pLang -# * Verify bugs 1-10: ./test_verify_bugs.sh -pLang -b1..10 -# * Verify bugs 1 and 3: ./test_verify_bugs.sh -pLang -b1 -b3 -# * Verify bugs 1-10 and 20: ./test_verify_bugs.sh -pLang -b1..10 -b20 -# * Verify bug 2 with DEBUG ./test_verify_bugs.sh -pLang -b 2 -D -# -################################################################################ -# Import helper subroutines and variables, and init Defects4J -source test.include - -# Print usage message and exit -usage() { - local known_pids=$(defects4j pids) - echo "usage: $0 -p [-b ... | -b ... ] [-D]" - echo "Project ids:" - for pid in $known_pids; do - echo " * $pid" - done - exit 1 -} - -# Run only relevant tests by default -TEST_FLAG="-r" -# Debugging is off by default -DEBUG="" - -# Check arguments -while getopts ":p:b:AD" opt; do - case $opt in - A) TEST_FLAG="" - ;; - D) DEBUG="-D" - ;; - p) PID="$OPTARG" - ;; - b) if [[ "$OPTARG" =~ ^[0-9]*\.\.[0-9]*$ ]]; then - BUGS="$BUGS $(eval echo {$OPTARG})" - else - BUGS="$BUGS $OPTARG" - fi - ;; - \?) - echo "Unknown option: -$OPTARG" >&2 - usage - ;; - :) - echo "No argument provided: -$OPTARG." >&2 - usage - ;; - esac -done - -if [ "$PID" == "" ]; then - usage -fi - -if [ ! -e "$BASE_DIR/framework/core/Project/$PID.pm" ]; then - usage -fi - -init - -# Run all bugs, unless otherwise specified -if [ "$BUGS" == "" ]; then - BUGS="$(get_bug_ids $BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE)" -fi - -if [ "$DEBUG" == "-D" ]; then - export D4J_DEBUG=1 -fi - -# Create log file -script_name=$(echo $script | sed 's/\.sh$//') -LOG="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).log" -DIR_FAILING="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).failing_tests" - -################################################################################ -# Run developer-written tests on all buggy and fixed program versions, and -# verify trigger tests -################################################################################ - -# Reproduce all bugs (and log all results), regardless of whether errors occur -HALT_ON_ERROR=0 - -test_dir="$TMP_DIR/test_trigger" -mkdir -p $test_dir - -mkdir -p $DIR_FAILING - -work_dir="$test_dir/$PID" - -function sed_cmd() -{ - if [ $(uname -s) = "Darwin" ]; then - sed -i '' $1 $2 - else - sed -i $1 $2 - fi -} - -# Clean working directory -rm -rf $work_dir -for bid in $(echo $BUGS); do - # Skip all bug ids that do not exist in the active-bugs csv - if ! grep -q "^$bid," "$BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE"; then - warn "Skipping bug ID that is not listed in active-bugs csv: $PID-$bid" - continue - fi - - for v in "b" "f"; do - vid=${bid}$v - defects4j checkout -p $PID -v "$vid" -w "$work_dir" || die "checkout: $PID-$vid" - case $PID in - Cli|Time) - # doesn't always exist - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml - # only used when no maven-build.xml - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/build.xml - ;; - Closure) - sed_cmd "s/target-jvm: 1\.[1-5]/target-jvm 1.6/" $work_dir/lib/rhino/build.properties - sed_cmd "s/source-level: 1\.[1-5]/source-level 1.6/" $work_dir/lib/rhino/build.properties - ;; - Codec) - sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties - ;; - Compress|Csv|Jsoup) - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml - ;; - Gson) - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/gson/maven-build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/gson/maven-build.xml - ;; - Lang) - # either this - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml - # or this - sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties - ;; - Math) - sed_cmd "s/value=\"1\.[1-5]\"/value=\"1.6\"/" $work_dir/build.xml - ;; - esac - defects4j compile -w "$work_dir" || die "compile: $PID-$vid" - defects4j test $TEST_FLAG -w "$work_dir" || die "run relevant tests: $PID-$vid" - - cat "$work_dir/failing_tests" > "$DIR_FAILING/$vid" - - triggers=$(num_triggers "$work_dir/failing_tests") - # Expected number of failing tests for each fixed version is 0! - if [ $v == "f" ]; then - [ $triggers -eq 0 ] \ - || die "verify number of triggering tests: $PID-$vid (expected: 0, actual: $triggers)" - continue - fi - - # Expected number of failing tests for each buggy version is equal - # to the number of provided triggering tests - expected=$(num_triggers "$BASE_DIR/framework/projects/$PID/trigger_tests/$bid") - - # Fail if there are no trigger tests - [ $expected -gt 0 ] || die "Metadata error: There are no trigger tests for $PID-$vid" - - [ $triggers -eq $expected ] \ - || die "verify number of triggering tests: $PID-$vid (expected: $expected, actual: $triggers)" - for t in $(get_triggers "$BASE_DIR/framework/projects/$PID/trigger_tests/$bid"); do - grep -q "$t" "$work_dir/failing_tests" || die "expected triggering test $t did not fail" - done - done -done - -if [ "$DEBUG" != "-D" ]; then - rm -rf $TMP_DIR -fi -HALT_ON_ERROR=1 - -# Print a summary of what went wrong -if [ $ERROR != 0 ]; then - printf '=%.s' $(seq 1 80) 1>&2 - echo 1>&2 - echo "The following errors occurred:" 1>&2 - cat $LOG 1>&2 -fi - -# Indicate whether an error occurred -exit $ERROR diff --git a/framework/test/test_verify_bugs.sh.orig b/framework/test/test_verify_bugs.sh.orig deleted file mode 100755 index 896abe0f1..000000000 --- a/framework/test/test_verify_bugs.sh.orig +++ /dev/null @@ -1,197 +0,0 @@ -#!/usr/bin/env bash -################################################################################ -# -# This script verifies that all bugs for a given project are reproducible and -# that the provided information about triggering tests is correct. -# This script must be run from its own directory (`framework/tests/`). -# -# By default, this script runs only relevant tests. Set the -A flag to run all -# tests. Set the -D flag to enable verbose logging (D4J_DEBUG). -# -# Examples for Lang: -# * Verify all bugs: ./test_verify_bugs.sh -pLang -# * Verify bugs 1-10: ./test_verify_bugs.sh -pLang -b1..10 -# * Verify bugs 1 and 3: ./test_verify_bugs.sh -pLang -b1 -b3 -# * Verify bugs 1-10 and 20: ./test_verify_bugs.sh -pLang -b1..10 -b20 -# * Verify bug 2 with DEBUG ./test_verify_bugs.sh -pLang -b 2 -D -# -################################################################################ -# Import helper subroutines and variables, and init Defects4J -source test.include - -# Print usage message and exit -usage() { - local known_pids=$(defects4j pids) - echo "usage: $0 -p [-b ... | -b ... ] [-D]" - echo "Project ids:" - for pid in $known_pids; do - echo " * $pid" - done - exit 1 -} - -# Run only relevant tests by default -TEST_FLAG="-r" -# Debugging is off by default -DEBUG="" - -# Check arguments -while getopts ":p:b:AD" opt; do - case $opt in - A) TEST_FLAG="" - ;; - D) DEBUG="-D" - ;; - p) PID="$OPTARG" - ;; - b) if [[ "$OPTARG" =~ ^[0-9]*\.\.[0-9]*$ ]]; then - BUGS="$BUGS $(eval echo {$OPTARG})" - else - BUGS="$BUGS $OPTARG" - fi - ;; - \?) - echo "Unknown option: -$OPTARG" >&2 - usage - ;; - :) - echo "No argument provided: -$OPTARG." >&2 - usage - ;; - esac -done - -if [ "$PID" == "" ]; then - usage -fi - -if [ ! -e "$BASE_DIR/framework/core/Project/$PID.pm" ]; then - usage -fi - -init - -# Run all bugs, unless otherwise specified -if [ "$BUGS" == "" ]; then - BUGS="$(get_bug_ids $BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE)" -fi - -if [ "$DEBUG" == "-D" ]; then - export D4J_DEBUG=1 -fi - -# Create log file -script_name=$(echo $script | sed 's/\.sh$//') -LOG="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).log" -DIR_FAILING="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).failing_tests" - -################################################################################ -# Run developer-written tests on all buggy and fixed program versions, and -# verify trigger tests -################################################################################ - -# Reproduce all bugs (and log all results), regardless of whether errors occur -HALT_ON_ERROR=0 - -test_dir="$TMP_DIR/test_trigger" -mkdir -p $test_dir - -mkdir -p $DIR_FAILING - -work_dir="$test_dir/$PID" - -function sed_cmd() -{ - if [ $(uname -s) = "Darwin" ]; then - sed -i '' $1 $2 - else - sed -i $1 $2 - fi -} - -# Clean working directory -rm -rf $work_dir -for bid in $(echo $BUGS); do - # Skip all bug ids that do not exist in the active-bugs csv - if ! grep -q "^$bid," "$BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE"; then - warn "Skipping bug ID that is not listed in active-bugs csv: $PID-$bid" - continue - fi - - for v in "b" "f"; do - vid=${bid}$v - defects4j checkout -p $PID -v "$vid" -w "$work_dir" || die "checkout: $PID-$vid" - case $PID in - Cli|Time) - # doesn't always exist - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml - # only used when no maven-build.xml - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/build.xml - ;; - Closure) - sed_cmd "s/target-jvm: 1\.[1-5]/target-jvm 1.6/" $work_dir/lib/rhino/build.properties - sed_cmd "s/source-level: 1\.[1-5]/source-level 1.6/" $work_dir/lib/rhino/build.properties - ;; - Codec) - sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties - ;; - Compress|Csv|Jsoup) - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/maven-build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/maven-build.xml - ;; - Gson) - sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/gson/maven-build.xml - sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/gson/maven-build.xml - ;; - Lang) - sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties - ;; - Math) - sed_cmd "s/value=\"1\.[1-5]\"/value=\"1.6\"/" $work_dir/build.xml - ;; - esac - defects4j compile -w "$work_dir" || die "compile: $PID-$vid" - defects4j test $TEST_FLAG -w "$work_dir" || die "run relevant tests: $PID-$vid" - - cat "$work_dir/failing_tests" > "$DIR_FAILING/$vid" - - triggers=$(num_triggers "$work_dir/failing_tests") - # Expected number of failing tests for each fixed version is 0! - if [ $v == "f" ]; then - [ $triggers -eq 0 ] \ - || die "verify number of triggering tests: $PID-$vid (expected: 0, actual: $triggers)" - continue - fi - - # Expected number of failing tests for each buggy version is equal - # to the number of provided triggering tests - expected=$(num_triggers "$BASE_DIR/framework/projects/$PID/trigger_tests/$bid") - - # Fail if there are no trigger tests - [ $expected -gt 0 ] || die "Metadata error: There are no trigger tests for $PID-$vid" - - [ $triggers -eq $expected ] \ - || die "verify number of triggering tests: $PID-$vid (expected: $expected, actual: $triggers)" - for t in $(get_triggers "$BASE_DIR/framework/projects/$PID/trigger_tests/$bid"); do - grep -q "$t" "$work_dir/failing_tests" || die "expected triggering test $t did not fail" - done - done -done - -if [ "$DEBUG" != "-D" ]; then - rm -rf $TMP_DIR -fi -HALT_ON_ERROR=1 - -# Print a summary of what went wrong -if [ $ERROR != 0 ]; then - printf '=%.s' $(seq 1 80) 1>&2 - echo 1>&2 - echo "The following errors occurred:" 1>&2 - cat $LOG 1>&2 -fi - -# Indicate whether an error occurred -exit $ERROR From 79c377ccc7155ab2358fc50492445a93ada71967 Mon Sep 17 00:00:00 2001 From: Mark Roberts Date: Fri, 17 Nov 2023 08:27:59 -0800 Subject: [PATCH 4/4] updates from pull request review --- framework/core/Project/Lang.pm | 64 ++-------------------------------- 1 file changed, 2 insertions(+), 62 deletions(-) diff --git a/framework/core/Project/Lang.pm b/framework/core/Project/Lang.pm index 81c618be3..56d2ed20f 100644 --- a/framework/core/Project/Lang.pm +++ b/framework/core/Project/Lang.pm @@ -57,17 +57,6 @@ sub new { return $class->SUPER::new($PID, $name, $vcs); } -sub printstack { - 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 "$filename:$line $subroutine\n"; - $i++; - } -} - # # Determines the directory layout for sources and tests # @@ -88,55 +77,6 @@ sub determine_layout { return $result; } -# -# Existing Ant build.xml and default.properties -# -sub _layout1 { - @_ == 1 or die $ARG_ERROR; - my ($dir) = @_; - my $src = `grep "source.home" $dir/default.properties 2>/dev/null`; - my $test = `grep "test.home" $dir/default.properties 2>/dev/null`; - - return undef if ($src eq "" || $test eq ""); - - $src =~ s/\s*source.home\s*=\s*(\S+)\s*/$1/; - $test=~ s/\s*test.home\s*=\s*(\S+)\s*/$1/; - - return {src=>$src, test=>$test}; -} - -# -# Generated build.xml (from mvn ant:ant) with maven-build.properties -# -sub _layout2 { - @_ == 1 or die $ARG_ERROR; - my ($dir) = @_; - my $src = `grep "maven.build.srcDir.0" $dir/maven-build.properties 2>/dev/null`; - my $test = `grep "maven.build.testDir.0" $dir/maven-build.properties 2>/dev/null`; - - return undef if ($src eq "" || $test eq ""); - - $src =~ s/\s*maven\.build\.srcDir\.0\s*=\s*(\S+)\s*/$1/; - $test=~ s/\s*maven\.build\.testDir\.0\s*=\s*(\S+)\s*/$1/; - - return {src=>$src, test=>$test}; -} - -## -## Converts file encoding from iso-8859-1 to utf-8 -## -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); - } -} - # # Copy the generated build.xml, if necessary. # @@ -146,8 +86,8 @@ sub _post_checkout { # Convert the file encoding of problematic files my $result = determine_layout($self, $revision_id); - convert_file_encoding($work_dir."/".$result->{src}."/org/apache/commons/lang3/text/translate/EntityArrays.java"); - convert_file_encoding($work_dir."/".$result->{src}."/org/apache/commons/lang/Entities.java"); + Utils::convert_file_encoding($work_dir."/".$result->{src}."/org/apache/commons/lang3/text/translate/EntityArrays.java"); + Utils::convert_file_encoding($work_dir."/".$result->{src}."/org/apache/commons/lang/Entities.java"); # remove old pre Java 1.5 code print($work_dir."/".$result->{src}."/org/apache/commons/lang/enum\n");