Skip to content

Commit

Permalink
feat: add expected bugs and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenglinli committed Aug 3, 2023
1 parent a8560be commit 026e30f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/sqlancer/stonedb/StoneDBBugs.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ public final class StoneDBBugs {
// INSERT INTO t0(c0) VALUES (DEFAULT);
// SELECT t0.c0 FROM t0 WHERE (('OC')>=(((t0.c0) IS NULL))); -- expected empty set but got 1 row
public static boolean bugNotReported3 = true;
// CREATE TABLE t0(c0 CHAR PRIMARY KEY);
// INSERT IGNORE INTO t0(c0) VALUE (DEFAULT);
// SELECT t0.c0 FROM t0 WHERE (t0.c0 BETWEEN (0) AND t0.c0); -- 1
public static boolean bugNotReported4 = true;
// CREATE TABLE t0(c0 INT);
// INSERT INTO t0(c0) VALUE (DEFAULT);
// SELECT * FROM t0 WHERE (('00')>((('')AND(t0.c0)))); -- expected empty set but got 1 row
public static boolean bugNotReported5 = true;

private StoneDBBugs() {
}
Expand Down
3 changes: 3 additions & 0 deletions src/sqlancer/stonedb/StoneDBErrors.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public static void addExpectedExpressionErrors(ExpectedErrors errors) {
// com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: BIGINT value is out of range in
// '-((`database0`.`t0`.`c1` >> (not(`database0`.`t0`.`c1`))))'
errors.add("Data truncation: BIGINT value is out of range in ");
// com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: BIGINT UNSIGNED value is out of range in
// '(`database10`.`t0`.`c0` + (`database10`.`t0`.`c0` & (not(0.5))))'
errors.add("Data truncation: BIGINT UNSIGNED value is out of range in ");
}

}
7 changes: 5 additions & 2 deletions src/sqlancer/stonedb/gen/StoneDBTableInsertGenerator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package sqlancer.stonedb.gen;

import static sqlancer.stonedb.StoneDBBugs.bugNotReported4;
import static sqlancer.stonedb.StoneDBBugs.bugNotReported5;

import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -38,7 +41,7 @@ private SQLQueryAdapter getQuery() {
sb.append(" ");
sb.append(Randomly.fromOptions("LOW_PRIORITY", "DELAYED", "HIGH_PRIORITY"));
}
if (Randomly.getBoolean()) {
if (!bugNotReported4 && Randomly.getBoolean()) {
sb.append(" IGNORE");
}
sb.append(" INTO ");
Expand Down Expand Up @@ -111,7 +114,7 @@ private void appendOneValue(int nrRow) {
// append one column of one row
@Override
protected void insertValue(StoneDBColumn column) {
if (Randomly.getBooleanWithRatherLowProbability()) {
if (!bugNotReported5 && Randomly.getBooleanWithRatherLowProbability()) {
sb.append("DEFAULT");
} else {
sb.append(StoneDBToStringVisitor.asString(new StoneDBExpressionGenerator(globalState)
Expand Down

0 comments on commit 026e30f

Please sign in to comment.