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

Fix some bugs #108

Merged
merged 8 commits into from
Sep 15, 2022
Merged
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
7 changes: 0 additions & 7 deletions assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@
<include>mo.yml</include>
<include>run.yml</include>
<include>log4j.properties</include>
</includes>
<fileMode>755</fileMode>
<outputDirectory>./</outputDirectory>
</fileSet>
<fileSet>
<directory>./</directory>
<includes>
<include>run.sh</include>
</includes>
<fileMode>755</fileMode>
Expand Down
3 changes: 1 addition & 2 deletions cases/template.result
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ select min(int32),max(int32),max(int32)-1 from t1;
min(int32) max(int32) max(int32) - 1
-1 2147483647 2147483646
select min(int32),max(int32),max(int32)-1 from t1 group by a;
min(int32) max(int32) max(int32) - 1
-1 2147483647 2147483646
[unknown result because it is related to issue#1234]
drop table t1;
CREATE TABLE NATION (
N_NATIONKEY INTEGER NOT NULL,
Expand Down
2 changes: 2 additions & 0 deletions cases/template.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ create table t1 ( a int not null default 1, int32 int primary key);
insert into t1 (int32) values (-1),(1234567890),(2147483647);
select * from t1 order by a desc, int32 asc;
select min(int32),max(int32),max(int32)-1 from t1;
-- @bvt:issue#1234
select min(int32),max(int32),max(int32)-1 from t1 group by a;
-- @bvt:issue
drop table t1;
CREATE TABLE NATION (
N_NATIONKEY INTEGER NOT NULL,
Expand Down
Binary file modified lib/mo-tester-1.0-SNAPSHOT.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</build>
<packaging>jar</packaging>

<name>morunner</name>
<name>mo-tester</name>
<url>http://maven.apache.org</url>

<properties>
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/io/mo/Tester.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ public static void main(String[] args){

public static void run(File file){
if(file.isFile()){
if(file.getName().endsWith(".result"))
if(!(file.getName().endsWith(".sql") || file.getName().endsWith(".test"))) {
return;
}

if(isInclude(file.getName())) {
ScriptParser.parseScript(file.getPath());
Expand All @@ -186,8 +187,9 @@ public static void run(File file){

public static void generateRs(File file){
if(file.isFile()){
if(file.getName().endsWith(".result"))
if(!(file.getName().endsWith(".sql") || file.getName().endsWith(".test"))) {
return;
}

if(isInclude(file.getName())) {
ScriptParser.parseScript(file.getPath());
Expand All @@ -209,8 +211,9 @@ public static void generateRs(File file){

public static void debug(File file){
if(file.isFile()){
if(file.getName().endsWith(".result"))
if(!(file.getName().endsWith(".sql") || file.getName().endsWith(".test"))) {
return;
}

if(isInclude(file.getName())) {
ScriptParser.parseScript(file.getPath());
Expand All @@ -228,8 +231,9 @@ public static void debug(File file){

public static void check(File file){
if(file.isFile()){
if(file.getName().endsWith(".result"))
if(!(file.getName().endsWith(".sql") || file.getName().endsWith(".test"))) {
return;
}
if(isInclude(file.getName())) {
ScriptParser.parseScript(file.getPath());
TestScript script = ScriptParser.getTestScript();
Expand Down
23 changes: 21 additions & 2 deletions src/main/java/io/mo/db/Executor.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,26 @@ public static boolean genRS(TestScript script){
ArrayList<SqlCommand> commands = script.getCommands();
for (int j = 0; j < commands.size(); j++) {
SqlCommand command = null;

try{
command = commands.get(j);

if(command.isIgnore()) {
rs_writer.write(command.getCommand().trim());
rs_writer.newLine();
if (isUpdate) {
if (command.getExpResult() != null) {
if (command.getExpResult().getType() != RESULT.STMT_RESULT_TYPE_NONE)
rs_writer.write(command.getExpResult().getOrginalRSText());
}
} else {
rs_writer.write("[unknown result because it is related to issue#" + command.getIssueNo() + "]");
}
if(j < commands.size() -1)
rs_writer.newLine();
continue;
}

connection = getConnection(command);
statement = connection.createStatement();

Expand All @@ -238,7 +256,8 @@ public static boolean genRS(TestScript script){
actResult.setCommand(command);
rs_writer.write(command.getCommand().trim());
rs_writer.newLine();
if(command.isIgnore()) {
rs_writer.write(actResult.toString());
/*if(command.isIgnore()) {
if (isUpdate) {
if (command.getExpResult() != null) {
if (command.getExpResult().getType() != RESULT.STMT_RESULT_TYPE_NONE)
Expand All @@ -254,7 +273,7 @@ public static boolean genRS(TestScript script){
}
else {
rs_writer.write(actResult.toString());
}
}*/

if(j < commands.size() -1)
rs_writer.newLine();
Expand Down