Add stack leak test to WriteReadCompare

PiperOrigin-RevId: 572953669
Change-Id: Id6cad3fc86777d68f218119f67c9dc473bdcfcc8
This commit is contained in:
Yuval Tassa
2023-10-12 10:52:40 -07:00
committed by Copybara-Service
parent 86859ad382
commit 493ae95d69
2 changed files with 9 additions and 1 deletions
+1
View File
@@ -1,6 +1,7 @@
<mujoco>
<compiler autolimits="true" />
<default>
<joint armature="0.1"/>
<default class="limited_false">
<joint limited="false"/>
</default>
+8 -1
View File
@@ -1049,8 +1049,10 @@ mjtNum CompareModel(const mjModel* m1, const mjModel* m2,
}
TEST_F(PluginTest, WriteReadCompare) {
// full precision float printing
FullFloatPrecision increase_precision;
// Loop over all xml files in data
// loop over all xml files in data
std::vector<std::string> paths = {GetTestDataFilePath("."),
GetModelPath(".")};
std::string ext(".xml");
@@ -1101,6 +1103,11 @@ TEST_F(PluginTest, WriteReadCompare) {
mj_deleteModel(mtemp);
}
// check for stack memory leak
mj_step(m, d);
EXPECT_EQ(d->pstack, 0) << "mjData stack memory leak detected in " <<
p.path().string() << '\n';
// delete original structures
mj_deleteData(d);
mj_deleteModel(m);