-
Notifications
You must be signed in to change notification settings - Fork 198
Dev p3.0/param testcases #879
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
base: major/P3.0
Are you sure you want to change the base?
Changes from all commits
6be2b01
82637c6
7b55329
8cfe5c9
d630b9f
f39c431
246d1d6
71b519b
740de07
5def42a
38dbf6d
08ee970
57d7c4b
1a9754d
50463f5
658c304
924eced
60d3fb4
bd3d167
c7e86ab
ef898a0
55a1199
c5c6c72
28833bf
5c77847
a4a6195
e8c605a
5320e40
936c47e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,7 +176,7 @@ public static TestingEngine Create(CheckerConfiguration checkerConfiguration) => | |
/// <summary> | ||
/// Creates a new systematic testing engine. | ||
/// </summary> | ||
public static TestingEngine Create(CheckerConfiguration checkerConfiguration, Assembly assembly) | ||
private static TestingEngine Create(CheckerConfiguration checkerConfiguration, Assembly assembly) | ||
{ | ||
if (checkerConfiguration.ListTestCases) | ||
{ | ||
|
@@ -190,7 +190,7 @@ public static TestingEngine Create(CheckerConfiguration checkerConfiguration, As | |
Console.Out.WriteLine($"{mi.DeclaringType.Name}"); | ||
} | ||
|
||
Environment.Exit(0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is needed because, for parametric tests, we have to fetch all the test case names using this function. The problem is that it calls Environment.Exit(0), which ends the entire regression test run early. So we had to handle it differently to avoid stopping the whole suite. |
||
return null; | ||
} | ||
catch | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.Design; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
@@ -21,7 +22,8 @@ public class PCheckerCodeGenerator : ICodeGenerator | |
/// This compiler has a compilation stage. | ||
/// </summary> | ||
public bool HasCompilationStage => true; | ||
private static List<Variable> _globalParams = []; | ||
[ThreadStatic] | ||
private static List<Variable> _globalParams; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was causing issues when I ran regression tests in parallel. Since _globalParams was static, all the tests were sharing the same list, which led to conflicts. Adding [ThreadStatic] makes sure each test thread gets its own copy, so they don’t mess with each other. |
||
|
||
private string GetGlobalParamAndLocalVariableName(CompilationContext context, Variable v) | ||
{ | ||
|
@@ -346,6 +348,7 @@ private static void WriteForeignType(CompilationContext context, StringWriter ou | |
// For normal test, the assignment is empty dictionary | ||
private void WriteSafetyTestDecl(CompilationContext context, StringWriter output, SafetyTest safety, Dictionary<Variable, IPExpr> assignment) | ||
{ | ||
// Console.WriteLine($"dic: {string.Join(',', dic.ToList())}"); | ||
WriteNameSpacePrologue(context, output); | ||
var name = ParamAssignment.RenameSafetyTestByAssignment(context.Names.GetNameForDecl(safety), assignment); | ||
context.WriteLine(output, $"public class {name} {{"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
BasicNonParametricTest | ||
FullCartesianProductParametricTest___g1_1__g2_3__g3_5__g4_7 | ||
FullCartesianProductParametricTest___g1_2__g2_3__g3_5__g4_7 | ||
FullCartesianProductParametricTest___g1_1__g2_4__g3_5__g4_7 | ||
FullCartesianProductParametricTest___g1_2__g2_4__g3_5__g4_7 | ||
FullCartesianProductParametricTest___g1_1__g2_3__g3_6__g4_7 | ||
FullCartesianProductParametricTest___g1_2__g2_3__g3_6__g4_7 | ||
FullCartesianProductParametricTest___g1_1__g2_4__g3_6__g4_7 | ||
FullCartesianProductParametricTest___g1_2__g2_4__g3_6__g4_7 | ||
FullCartesianProductParametricTest___g1_1__g2_3__g3_5__g4_8 | ||
FullCartesianProductParametricTest___g1_2__g2_3__g3_5__g4_8 | ||
FullCartesianProductParametricTest___g1_1__g2_4__g3_5__g4_8 | ||
FullCartesianProductParametricTest___g1_2__g2_4__g3_5__g4_8 | ||
FullCartesianProductParametricTest___g1_1__g2_3__g3_6__g4_8 | ||
FullCartesianProductParametricTest___g1_2__g2_3__g3_6__g4_8 | ||
FullCartesianProductParametricTest___g1_1__g2_4__g3_6__g4_8 | ||
FullCartesianProductParametricTest___g1_2__g2_4__g3_6__g4_8 | ||
ParametricTestWithAssumption___g1_1__g2_3__g3_5__g4_7 | ||
ParametricTestWithAssumption___g1_2__g2_3__g3_5__g4_7 | ||
ParametricTestWithAssumption___g1_1__g2_4__g3_5__g4_7 | ||
ParametricTestWithAssumption___g1_2__g2_4__g3_5__g4_7 | ||
ParametricTestWithAssumption___g1_1__g2_3__g3_6__g4_7 | ||
ParametricTestWithAssumption___g1_2__g2_3__g3_6__g4_7 | ||
ParametricTestWithAssumption___g1_1__g2_4__g3_6__g4_7 | ||
ParametricTestWithAssumption___g1_2__g2_4__g3_6__g4_7 | ||
ParametricTestWithAssumption___g1_1__g2_3__g3_5__g4_8 | ||
ParametricTestWithAssumption___g1_2__g2_3__g3_5__g4_8 | ||
ParametricTestWithAssumption___g1_1__g2_4__g3_5__g4_8 | ||
ParametricTestWithAssumption___g1_2__g2_4__g3_5__g4_8 | ||
ParametricTestWithAssumption___g1_1__g2_3__g3_6__g4_8 | ||
ParametricTestWithAssumption___g1_2__g2_3__g3_6__g4_8 | ||
ParametricTestWithAssumption___g1_1__g2_4__g3_6__g4_8 | ||
ParametricTestWithAssumption___g1_2__g2_4__g3_6__g4_8 | ||
ParametricTestWithBoolAssumption___g1_1__g2_3__g3_5__g4_7__b1_False | ||
ParametricTestWithBoolAssumption___g1_2__g2_3__g3_5__g4_7__b1_False | ||
ParametricTestWithBoolAssumption___g1_1__g2_4__g3_5__g4_7__b1_False | ||
ParametricTestWithBoolAssumption___g1_2__g2_4__g3_5__g4_7__b1_False | ||
ParametricTestWithBoolAssumption___g1_1__g2_3__g3_6__g4_7__b1_False | ||
ParametricTestWithBoolAssumption___g1_2__g2_3__g3_6__g4_7__b1_False | ||
ParametricTestWithBoolAssumption___g1_1__g2_4__g3_6__g4_7__b1_False | ||
ParametricTestWithBoolAssumption___g1_2__g2_4__g3_6__g4_7__b1_False | ||
ParametricTestWithBoolAssumption___g1_1__g2_3__g3_5__g4_8__b1_False | ||
ParametricTestWithBoolAssumption___g1_2__g2_3__g3_5__g4_8__b1_False | ||
ParametricTestWithBoolAssumption___g1_1__g2_4__g3_5__g4_8__b1_False | ||
ParametricTestWithBoolAssumption___g1_2__g2_4__g3_5__g4_8__b1_False | ||
ParametricTestWithBoolAssumption___g1_1__g2_3__g3_6__g4_8__b1_False | ||
ParametricTestWithBoolAssumption___g1_2__g2_3__g3_6__g4_8__b1_False | ||
ParametricTestWithBoolAssumption___g1_1__g2_4__g3_6__g4_8__b1_False | ||
ParametricTestWithBoolAssumption___g1_2__g2_4__g3_6__g4_8__b1_False | ||
TWise1CoverageTest___g1_1__g2_3__g3_5__g4_7__b1_True | ||
TWise1CoverageTest___g1_2__g2_4__g3_6__g4_8__b1_False | ||
TWise2CoverageTest___g1_1__g2_3__g3_5__g4_7__b1_True | ||
TWise2CoverageTest___g1_2__g2_4__g3_6__g4_8__b1_True | ||
TWise2CoverageTest___g1_2__g2_4__g3_5__g4_7__b1_False | ||
TWise2CoverageTest___g1_1__g2_3__g3_6__g4_8__b1_False | ||
TWise2CoverageTest___g1_2__g2_3__g3_6__g4_7__b1_True | ||
TWise2CoverageTest___g1_1__g2_4__g3_5__g4_8__b1_True | ||
TWise3CoverageTest___g1_1__g2_3__g3_5__g4_7__b1_True | ||
TWise3CoverageTest___g1_2__g2_4__g3_6__g4_7__b1_True | ||
TWise3CoverageTest___g1_2__g2_3__g3_5__g4_8__b1_False | ||
TWise3CoverageTest___g1_1__g2_4__g3_6__g4_8__b1_False | ||
TWise3CoverageTest___g1_1__g2_4__g3_5__g4_8__b1_True | ||
TWise3CoverageTest___g1_2__g2_3__g3_6__g4_8__b1_True | ||
TWise3CoverageTest___g1_2__g2_4__g3_5__g4_7__b1_False | ||
TWise3CoverageTest___g1_1__g2_3__g3_6__g4_7__b1_False | ||
TWise3CoverageTest___g1_2__g2_3__g3_5__g4_7__b1_True | ||
TWise3CoverageTest___g1_1__g2_4__g3_6__g4_7__b1_True | ||
TWise3CoverageTest___g1_1__g2_3__g3_5__g4_8__b1_False | ||
TWise3CoverageTest___g1_2__g2_4__g3_6__g4_8__b1_False |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
param g1 : int; | ||
param g2 : int; | ||
param g3 : int; | ||
param g4 : int; | ||
|
||
machine Main { | ||
var M: machine; | ||
start state Init { | ||
entry { | ||
print format("global varaible g1 = {0}", g1); | ||
print format("global varaible g2 = {0}", g2); | ||
print format("global varaible g3 = {0}", g3); | ||
print format("global varaible g4 = {0}", g4); | ||
} | ||
} | ||
} | ||
|
||
|
||
test BasicNonParametricTest [main=Main]:{Main}; | ||
|
||
test param (g1 in [1, 2], g2 in [3, 4], g3 in [5, 6], g4 in [7, 8]) FullCartesianProductParametricTest [main=Main]:{Main}; | ||
|
||
test param (g1 in [1, 2], g2 in [3, 4], g3 in [5, 6], g4 in [7, 8]) assume (g1 + g2 < g3 + g4) ParametricTestWithAssumption [main=Main]:{Main}; | ||
|
||
param b1: bool; | ||
|
||
test param (g1 in [1, 2], g2 in [3, 4], g3 in [5, 6], g4 in [7, 8], b1 in [true, false]) assume (b1 == (g1 + g2 > g3 + g4)) ParametricTestWithBoolAssumption [main=Main]:{Main}; | ||
|
||
test param (g1 in [1, 2], g2 in [3, 4], g3 in [5, 6], g4 in [7, 8], b1 in [true, false]) (1 wise) TWise1CoverageTest [main=Main]:{Main}; | ||
|
||
test param (g1 in [1, 2], g2 in [3, 4], g3 in [5, 6], g4 in [7, 8], b1 in [true, false]) (2 wise) TWise2CoverageTest [main=Main]:{Main}; | ||
|
||
test param (g1 in [1, 2], g2 in [3, 4], g3 in [5, 6], g4 in [7, 8], b1 in [true, false]) (3 wise) TWise3CoverageTest [main=Main]:{Main}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TestParam___g1_1__g2_3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
param g1 : int; | ||
param g2 : int; | ||
|
||
|
||
machine Main { | ||
var M: machine; | ||
start state Init { | ||
entry { | ||
print format("global varaible g1 = {0}", g1); | ||
print format("global varaible g2 = {0}", g2); | ||
assert g1 != 1 && g2 != 3 ; | ||
} | ||
} | ||
} | ||
|
||
|
||
test param (g1 in [1], g2 in [3]) TestParam [main=Main]:{Main}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
param g1 : int; | ||
|
||
machine Main { | ||
var M: machine; | ||
start state Init { | ||
entry { | ||
print format("global varaible g1 = {0}", g1); | ||
} | ||
} | ||
} | ||
|
||
test param (g1 in [2, 2]) Test1 [main=Main]:{Main}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
param g1 : int; | ||
|
||
machine Main { | ||
var M: machine; | ||
start state Init { | ||
entry { | ||
print format("global varaible g1 = {0}", g1); | ||
} | ||
} | ||
} | ||
|
||
|
||
test param (g1 in [1, 2]) (0 wise) TWise0CoverageTest [main=Main]:{Main}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please explain this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is to get better logs when the GitHub Action fails. Without it, we just see that something crashed, but not what caused it. With these flags, we get more detailed output and can tell which test hung or crashed, which makes debugging a lot easier.