Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed flaky test #1203

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import com.graphicsfuzz.common.util.IRandom;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Comparator;

public class TransformationProbabilities {

Expand Down Expand Up @@ -381,7 +383,13 @@ private boolean choose(int threshold, IRandom generator) {
@Override
public String toString() {
String result = "";
for (Field field : this.getClass().getDeclaredFields()) {
Field[] sortedFields = this.getClass().getDeclaredFields();
Arrays.sort(sortedFields, new Comparator<Field>() {
public int compare(Field field1, Field field2) {
return field1.getName().compareTo(field2.getName());
}
});
for (Field field : sortedFields) {
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ public class TransformationProbabilitiesTest {

@Test
public void testToString() {
assertEquals("probSubstituteFreeVariable: 80\n"
assertEquals("probAddDeadFragColorWrites: 5\n"
+ "probAddLiveFragColorWrites: 5\n"
+ "probDonateDeadCodeAtStmt: 5\n"
+ "probDonateLiveCodeAtStmt: 5\n"
+ "probInjectDeadBarrierAtStmt: 5\n"
+ "probInjectJumpAtStmt: 5\n"
+ "probWrapStmtInConditional: 5\n"
+ "probMutatePoint: 3\n"
+ "probVectorizeStmts: 3\n"
+ "probOutline: 5\n"
+ "probSplitLoops: 5\n"
+ "probStructify: 3\n"
+ "probOutline: 5\n"
+ "probAddLiveFragColorWrites: 5\n"
+ "probAddDeadFragColorWrites: 5\n"
+ "probSubstituteFreeVariable: 80\n"
+ "probSwitchify: 5\n"
+ "probInjectDeadBarrierAtStmt: 5\n",
+ "probVectorizeStmts: 3\n"
+ "probWrapStmtInConditional: 5\n",
TransformationProbabilities.SMALL_PROBABILITIES.toString());
}

Expand Down