|
11 | 11 | import java.util.List; |
12 | 12 | import java.util.stream.Collectors; |
13 | 13 |
|
| 14 | +import com.beust.jcommander.JCommander; |
| 15 | + |
14 | 16 | import sqlancer.AbstractAction; |
| 17 | +import sqlancer.CompositeTestOracle; |
15 | 18 | import sqlancer.DatabaseProvider; |
16 | 19 | import sqlancer.IgnoreMeException; |
17 | 20 | import sqlancer.Main.QueryManager; |
|
23 | 26 | import sqlancer.StateToReproduce; |
24 | 27 | import sqlancer.StateToReproduce.PostgresStateToReproduce; |
25 | 28 | import sqlancer.StatementExecutor; |
| 29 | +import sqlancer.TestOracle; |
26 | 30 | import sqlancer.postgres.PostgresSchema.PostgresColumn; |
27 | 31 | import sqlancer.postgres.PostgresSchema.PostgresTable; |
28 | 32 | import sqlancer.postgres.ast.PostgresExpression; |
|
47 | 51 | import sqlancer.postgres.gen.PostgresUpdateGenerator; |
48 | 52 | import sqlancer.postgres.gen.PostgresVacuumGenerator; |
49 | 53 | import sqlancer.postgres.gen.PostgresViewGenerator; |
50 | | -import sqlancer.postgres.test.PostgresNoRECOracle; |
51 | 54 | import sqlancer.sqlite3.gen.SQLite3Common; |
52 | 55 |
|
53 | 56 | // EXISTS |
@@ -201,6 +204,9 @@ public void generateAndTestDatabase(PostgresGlobalState globalState) throws SQLE |
201 | 204 | String databaseName = globalState.getDatabaseName(); |
202 | 205 | Connection con = globalState.getConnection(); |
203 | 206 | QueryManager manager = globalState.getManager(); |
| 207 | + PostgresOptions PostgresOptions = new PostgresOptions(); |
| 208 | + JCommander.newBuilder().addObject(PostgresOptions).build().parse(globalState.getOptions().getDbmsOptions().split(" ")); |
| 209 | + globalState.setPostgresOptions(PostgresOptions); |
204 | 210 | if (options.logEachSelect()) { |
205 | 211 | logger.writeCurrent(state); |
206 | 212 | } |
@@ -245,11 +251,20 @@ public void generateAndTestDatabase(PostgresGlobalState globalState) throws SQLE |
245 | 251 | globalState.setSchema(PostgresSchema.fromConnection(con, databaseName)); |
246 | 252 |
|
247 | 253 | manager.execute(new QueryAdapter("SET SESSION statement_timeout = 5000;\n")); |
248 | | - PostgresNoRECOracle or = new PostgresNoRECOracle(globalState.getSchema(), globalState.getRandomly(), con, |
249 | | - (PostgresStateToReproduce) state, logger, options, manager, globalState); |
| 254 | + |
| 255 | + |
| 256 | + List<TestOracle> oracles = globalState.getPostgresOptions().oracle.stream().map(o -> { |
| 257 | + try { |
| 258 | + return o.create(globalState); |
| 259 | + } catch (SQLException e1) { |
| 260 | + throw new AssertionError(e1); |
| 261 | + } |
| 262 | + }).collect(Collectors.toList()); |
| 263 | + CompositeTestOracle oracle = new CompositeTestOracle(oracles); |
| 264 | + |
250 | 265 | for (int i = 0; i < options.getNrQueries(); i++) { |
251 | 266 | try { |
252 | | - or.check(); |
| 267 | + oracle.check(); |
253 | 268 | } catch (IgnoreMeException e) { |
254 | 269 | continue; |
255 | 270 | } |
|
0 commit comments