Skip to content

Commit 28e4126

Browse files
committed
Add tests for rough edges
1 parent e9bc9ec commit 28e4126

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

unittests/Basic/ddg.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ makeDDG(const std::string &DDG,
2020
FAIL() << "Unsupported operation convertSUnits()";
2121
}
2222
void convertRegFiles() override {
23-
FAIL() << "Unsupported operation convertRegFile()";
23+
FAIL() << "Unsupported operation convertRegFiles()";
2424
}
2525
};
2626

unittests/Basic/ddg_test.cpp

+49
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "ddg.h"
22

3+
#include "gtest/gtest-spi.h"
34
#include "gtest/gtest.h"
45

56
using namespace llvm::opt_sched;
@@ -111,4 +112,52 @@ dep 5 0 "other" 0
111112

112113
EXPECT_EQ(7, DDG->GetNodeCnt());
113114
}
115+
116+
TEST(SimpleDDG, VirtualFunctionsFailWell) {
117+
static std::shared_ptr<DataDepGraph> DDG = makeDDG(R"(
118+
dag 3 "Simple"
119+
{
120+
dag_id fake:3
121+
dag_weight 1.000000
122+
compiler LLVM
123+
dag_lb -1
124+
dag_ub -1
125+
nodes
126+
node 0 "Inst"
127+
sched_order 0
128+
issue_cycle 0
129+
node 1 "artificial" "__optsched_entry"
130+
node 2 "artificial"
131+
dependencies
132+
dep 0 1 "other" 0
133+
dep 1 2 "other" 0
134+
}
135+
)");
136+
137+
EXPECT_FATAL_FAILURE(DDG->convertRegFiles(),
138+
"Unsupported operation convertRegFiles");
139+
EXPECT_FATAL_FAILURE(DDG->convertSUnits(true, true),
140+
"Unsupported operation convertSUnits");
141+
}
142+
143+
TEST(SimpleDDG, MakeInvalidDDGFailsWell) {
144+
EXPECT_NONFATAL_FAILURE(makeDDG(R"(
145+
dag 3 "Simple"
146+
{
147+
dag_id fake:3
148+
dag_weight 1.000000
149+
compiler LLVM
150+
dag_lb -1
151+
dag_ub -1
152+
nodes
153+
node 0 "Inst"
154+
sched_order 0
155+
issue_cycle 0
156+
node 1 "artificial" "__optsched_entry"
157+
node 2 "artificial"
158+
dependencies
159+
}
160+
)"),
161+
"parse DDG");
162+
}
114163
} // namespace

0 commit comments

Comments
 (0)