tests: Cleanup decompiler test fixtures and try to improve the test output / add a readable report (#1724)

* tests: add a Jak2 `FormRegressionTest` fixture

* tests/ci: minimize test log output and produce a readable report

* improve naming of report due to underlying GitHub issue

* hopefully fix windows handling of this argument

* test...

* final test

* test linux coverage
This commit is contained in:
Tyler Wilding
2022-08-05 12:12:33 -04:00
committed by GitHub
parent 5148523917
commit 8651179aa3
16 changed files with 576 additions and 520 deletions
@@ -4,7 +4,7 @@
using namespace decompiler;
TEST_F(FormRegressionTest, ExprArrayMethod2) {
TEST_F(FormRegressionTestJak1, ExprArrayMethod2) {
std::string func =
" sll r0, r0, 0\n"
"L130:\n"
@@ -665,35 +665,35 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" (format #t \")\")\n"
" arg0\n"
" )";
test_with_expr_jak1(func, type, expected, true, "array",
{{"L343", "~f"},
{"L342", "#("},
{"L341", "~D"},
{"L340", " ~D"},
{"L339", "#x~X"},
{"L338", " #x~X"},
{"L337", " ~f"},
{"L336", "~A"},
{"L335", " ~A"},
{"L334", ")"}},
"["
"\t\t[23, \"gp\", \"(array int32)\"],\n"
"\t\t[43, \"gp\", \"(array uint32)\"],\n"
"\t\t[63, \"gp\", \"(array int64)\"],\n"
"\t\t[83, \"gp\", \"(array uint64)\"],\n"
"\t\t[102, \"gp\", \"(array int8)\"],\n"
"\t\t[121, \"gp\", \"(array uint8)\"],\n"
"\t\t[141, \"gp\", \"(array int16)\"],\n"
"\t\t[161, \"gp\", \"(array uint16)\"],\n"
"\t\t[186, \"gp\", \"(array uint128)\"],\n"
"\t\t[204, \"gp\", \"(array int32)\"],\n"
"\t\t[223, \"gp\", \"(array float)\"],\n"
"\t\t[232, \"gp\", \"(array float)\"],\n"
"\t\t[249, \"gp\", \"(array basic)\"],\n"
"\t\t[258, \"gp\", \"(array basic)\"]]");
test_with_expr(func, type, expected, true, "array",
{{"L343", "~f"},
{"L342", "#("},
{"L341", "~D"},
{"L340", " ~D"},
{"L339", "#x~X"},
{"L338", " #x~X"},
{"L337", " ~f"},
{"L336", "~A"},
{"L335", " ~A"},
{"L334", ")"}},
"["
"\t\t[23, \"gp\", \"(array int32)\"],\n"
"\t\t[43, \"gp\", \"(array uint32)\"],\n"
"\t\t[63, \"gp\", \"(array int64)\"],\n"
"\t\t[83, \"gp\", \"(array uint64)\"],\n"
"\t\t[102, \"gp\", \"(array int8)\"],\n"
"\t\t[121, \"gp\", \"(array uint8)\"],\n"
"\t\t[141, \"gp\", \"(array int16)\"],\n"
"\t\t[161, \"gp\", \"(array uint16)\"],\n"
"\t\t[186, \"gp\", \"(array uint128)\"],\n"
"\t\t[204, \"gp\", \"(array int32)\"],\n"
"\t\t[223, \"gp\", \"(array float)\"],\n"
"\t\t[232, \"gp\", \"(array float)\"],\n"
"\t\t[249, \"gp\", \"(array basic)\"],\n"
"\t\t[258, \"gp\", \"(array basic)\"]]");
}
TEST_F(FormRegressionTest, ExprArrayMethod3) {
TEST_F(FormRegressionTestJak1, ExprArrayMethod3) {
std::string func =
" sll r0, r0, 0\n"
"L91:\n"
@@ -1226,31 +1226,31 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" )\n"
" arg0\n"
" )";
test_with_expr_jak1(func, type, expected, true, "array",
{{"L333", "[~8x] ~A~%"},
{"L332", "~Tallocated-length: ~D~%"},
{"L331", "~Tlength: ~D~%"},
{"L330", " ~Tcontent-type: ~A~%"},
{"L329", "~Tdata[~D]: @ #x~X~%"},
{"L328", "~T [~D] ~D~%"},
{"L327", "~T [~D] #x~X~%"},
{"L326", "~T [~D] ~f~%"},
{"L325", "~T [~D] ~A~%"}},
"[\t\t[44, \"gp\", \"(array int32)\"],\n"
"\t\t[62, \"gp\", \"(array uint32)\"],\n"
"\t\t[80, \"gp\", \"(array int64)\"],\n"
"\t\t[98, \"gp\", \"(array uint64)\"],\n"
"\t\t[115, \"gp\", \"(array int8)\"],\n"
"\t\t[132, \"gp\", \"(array int8)\"],\n"
"\t\t[150, \"gp\", \"(array int16)\"],\n"
"\t\t[168, \"gp\", \"(array uint16)\"],\n"
"\t\t[191, \"gp\", \"(array uint128)\"],\n"
"\t\t[207, \"gp\", \"(array int32)\"],\n"
"\t\t[226, \"gp\", \"(array float)\"],\n"
"\t\t[243, \"gp\", \"(array basic)\"]]");
test_with_expr(func, type, expected, true, "array",
{{"L333", "[~8x] ~A~%"},
{"L332", "~Tallocated-length: ~D~%"},
{"L331", "~Tlength: ~D~%"},
{"L330", " ~Tcontent-type: ~A~%"},
{"L329", "~Tdata[~D]: @ #x~X~%"},
{"L328", "~T [~D] ~D~%"},
{"L327", "~T [~D] #x~X~%"},
{"L326", "~T [~D] ~f~%"},
{"L325", "~T [~D] ~A~%"}},
"[\t\t[44, \"gp\", \"(array int32)\"],\n"
"\t\t[62, \"gp\", \"(array uint32)\"],\n"
"\t\t[80, \"gp\", \"(array int64)\"],\n"
"\t\t[98, \"gp\", \"(array uint64)\"],\n"
"\t\t[115, \"gp\", \"(array int8)\"],\n"
"\t\t[132, \"gp\", \"(array int8)\"],\n"
"\t\t[150, \"gp\", \"(array int16)\"],\n"
"\t\t[168, \"gp\", \"(array uint16)\"],\n"
"\t\t[191, \"gp\", \"(array uint128)\"],\n"
"\t\t[207, \"gp\", \"(array int32)\"],\n"
"\t\t[226, \"gp\", \"(array float)\"],\n"
"\t\t[243, \"gp\", \"(array basic)\"]]");
}
TEST_F(FormRegressionTest, ExprValid) {
TEST_F(FormRegressionTestJak1, ExprValid) {
std::string func =
" sll r0, r0, 0\n"
"L1:\n"
@@ -2013,7 +2013,7 @@ TEST_F(FormRegressionTest, ExprValid) {
" )\n"
" )\n"
"\n";
test_with_expr_jak1(
test_with_expr(
func, type, expected, false, "",
{{"L321", "ERROR: object #x~X ~S is not a valid object (misaligned)~%"},
{"L320", "ERROR: object #x~X ~S is not a valid object (bad address)~%"},
@@ -2027,7 +2027,7 @@ TEST_F(FormRegressionTest, ExprValid) {
"ERROR: object #x~X ~S is not a valid object of type '~A' (inside symbol table)~%"}});
}
TEST_F(FormRegressionTest, ExprStringToInt) {
TEST_F(FormRegressionTestJak1, ExprStringToInt) {
std::string func =
" sll r0, r0, 0\n"
"L14:\n"
@@ -2397,10 +2397,10 @@ TEST_F(FormRegressionTest, ExprStringToInt) {
" )\n"
" )\n"
" )";
test_final_function_jak1(func, type, expected);
test_final_function(func, type, expected);
}
TEST_F(FormRegressionTest, Method19ResTag) {
TEST_F(FormRegressionTestJak1, Method19ResTag) {
std::string func =
"sll r0, r0, 0\n"
"L101:\n"
@@ -2888,11 +2888,11 @@ TEST_F(FormRegressionTest, Method19ResTag) {
" (logior (logand 0 t0-6) (shl v1-14 32))\n"
" )\n"
" )";
test_with_expr_jak1(func, type, expected, false, "", {},
"[\n"
" [46, \"t2\", \"(pointer uint64)\"],\n"
" [100, \"t3\", \"(pointer uint64)\"],\n"
" [184, \"t5\", \"(pointer uint64)\"],\n"
" [64, \"t6\", \"(pointer uint64)\"]\n"
" ]");
}
test_with_expr(func, type, expected, false, "", {},
"[\n"
" [46, \"t2\", \"(pointer uint64)\"],\n"
" [100, \"t3\", \"(pointer uint64)\"],\n"
" [184, \"t5\", \"(pointer uint64)\"],\n"
" [64, \"t6\", \"(pointer uint64)\"]\n"
" ]");
}