]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2136] fix unit test error messages
authorAndrei Pavel <andrei@isc.org>
Fri, 5 Nov 2021 06:51:01 +0000 (08:51 +0200)
committerRazvan Becheriu <razvan@isc.org>
Thu, 18 Nov 2021 14:12:35 +0000 (16:12 +0200)
src/lib/yang/pretests/sysrepo_setup_tests.cc

index 4ef9bd3003995c88ad9efa0d1b3f8c0ff44baf8f..6668cc4145e9dbd38101a7cc9cb71dc2f40be1bb 100644 (file)
@@ -32,11 +32,8 @@ string missingModuleText(const string& name, const string& revision) {
     stringstream tmp;
     tmp << "ERROR: YANG module " << name << " is not installed." << endl
         << "The environment is not suitable for running unit tests." << endl
-        << "Please locate " << name << "@" << revision << ".yang, "
-        << "change to its directory and issue the following command:" << endl
-        << endl
-        << "sysrepoctl -i " << name << "@" << revision << ".yang" << endl
-        << endl
+        << "Please install the module " << name << ":" << endl
+        << "$ sysrepoctl -i ./src/share/yang/modules/" << name << "@" << revision << ".yang" << endl
         << endl;
     return (tmp.str());
 }
@@ -50,16 +47,13 @@ string missingModuleText(const string& name, const string& revision) {
 string badRevisionModuleText(const string& name, const string& expected,
                              const string& got) {
     stringstream tmp;
-    tmp << "ERROR: YANG module " << name << " is not installed with the right "
-        << "revision: expected " << expected << " but got " << got << endl
-        << "Please remove the module " << name << " and re-install it: "
-        << "Please locate " << name << "@" << expected << ".yang, " << endl
-        << "change to its directory and issue the following commands:"
-        << endl << endl
-        << "# sysrepoctl -u -m " << name << endl
-        << "# sysrepoctl -i -s " << REPOSITORY << "/yang "
-        << "-s . -g " << name << "@" << expected << ".yang" << endl
-        << endl << endl;
+    tmp << endl
+        << "ERROR: YANG module " << name << " is not installed with the right "
+        << "revision: got " << got << ", but expected " << expected << "." << endl
+        << "Please remove the module " << name << " and reinstall it: " << endl
+        << "$ sysrepoctl -u " << name << endl
+        << "$ sysrepoctl -i ./src/share/yang/modules/" << name << "@" << expected << ".yang" << endl
+        << endl;
     return (tmp.str());
 }
 
@@ -116,12 +110,12 @@ int main() {
 
     for (auto const& kv : YANG_REVISIONS) {
         std::string const& name(kv.first);
-        std::string const& revision(kv.second);
+        std::string const& expected_revision(kv.second);
         if (!installed_modules.count(name)) {
-            cerr << missingModuleText(name, revision);
+            cerr << missingModuleText(name, expected_revision);
             return (6);
         }
-        string const& expected_revision(installed_modules.at(name));
+        string const& revision(installed_modules.at(name));
         if (expected_revision != revision) {
             cerr << badRevisionModuleText(name, expected_revision, revision);
             return (7);