Packages: additional test for updating invalid
This is part of trying to trace a crash reported on the devel list, unfortunately the test passes but it’s sill good to have it
This commit is contained in:
@@ -861,6 +861,36 @@ void updateValidToInvalid(HTTP::Client* cl)
|
||||
SG_VERIFY(!vectorContains(root->catalogs(), c));
|
||||
}
|
||||
|
||||
void updateInvalidToInvalid(HTTP::Client* cl)
|
||||
{
|
||||
global_catalogVersion = 0;
|
||||
SGPath rootPath(simgear::Dir::current().path());
|
||||
rootPath.append("cat_update_invalid_to_inalid");
|
||||
simgear::Dir pd(rootPath);
|
||||
pd.removeChildren();
|
||||
|
||||
// first, sync the invalid version
|
||||
pkg::RootRef root(new pkg::Root(rootPath, "8.1.2"));
|
||||
root->setHTTPClient(cl);
|
||||
|
||||
pkg::CatalogRef c = pkg::Catalog::createFromUrl(root.ptr(), "http://localhost:2000/catalogTestInvalid/catalog.xml");
|
||||
waitForUpdateComplete(cl, root);
|
||||
SG_VERIFY(!c->isEnabled());
|
||||
|
||||
SG_VERIFY(c->status() == pkg::Delegate::FAIL_VALIDATION);
|
||||
SG_VERIFY(!vectorContains(root->catalogs(), c));
|
||||
SG_VERIFY(vectorContains(root->allCatalogs(), c));
|
||||
|
||||
// now refresh to a different, but still bad one
|
||||
global_catalogVersion = 3;
|
||||
c->refresh();
|
||||
waitForUpdateComplete(cl, root);
|
||||
SG_VERIFY(!c->isEnabled());
|
||||
SG_VERIFY(c->status() == pkg::Delegate::FAIL_VALIDATION);
|
||||
SG_VERIFY(!vectorContains(root->catalogs(), c));
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||
@@ -894,6 +924,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
updateInvalidToValid(&cl);
|
||||
updateValidToInvalid(&cl);
|
||||
updateInvalidToInvalid(&cl);
|
||||
|
||||
removeInvalidCatalog(&cl);
|
||||
|
||||
|
||||
@@ -671,7 +671,7 @@ void Root::cancelDownload(InstallRef aInstall)
|
||||
|
||||
void Root::catalogRefreshStatus(CatalogRef aCat, Delegate::StatusCode aReason)
|
||||
{
|
||||
CatalogDict::iterator catIt = d->catalogs.find(aCat->id());
|
||||
auto catIt = d->catalogs.find(aCat->id());
|
||||
d->fireRefreshStatus(aCat, aReason);
|
||||
|
||||
if (aReason == Delegate::STATUS_IN_PROGRESS) {
|
||||
|
||||
Reference in New Issue
Block a user