Improve Lua unit-test report
authorRobin Gareus <robin@gareus.org>
Fri, 6 Sep 2019 16:33:48 +0000 (18:33 +0200)
committerRobin Gareus <robin@gareus.org>
Fri, 6 Sep 2019 16:36:32 +0000 (18:36 +0200)
libs/ardour/test/lua_script_test.cc

index 081e3f989942c2b2ff4878845cb467ae54551d8a..e117d115a6f94b930c8421e6e3679d02e72f1391 100644 (file)
@@ -26,14 +26,20 @@ LuaScriptTest::session_script_test ()
 
                std::string script = "";
 
-               if (Glib::path_get_basename (spi->path).at(0) == '_') {
+               if (Glib::path_get_basename (spi->path).find ("__") == 0) {
                        continue;
                }
 
+               if (Glib::path_get_basename (spi->path).at(0) == '_') {
+                       std::cout << "LuaSession: " << spi->name << " (not bundled)\n";
+               } else {
+                       std::cout << "LuaSession: " << spi->name << "\n";
+               }
+
                try {
                        script = Glib::file_get_contents (spi->path);
                } catch (Glib::FileError const& e) {
-                       CPPUNIT_FAIL ("Cannot read script file");
+                       CPPUNIT_FAIL (spi->name + ": Cannot read script file");
                        continue;
                }
 
@@ -41,15 +47,15 @@ LuaScriptTest::session_script_test ()
                        LuaScriptParamList lsp = LuaScriptParams::script_params (spi, "sess_params");
                        _session->register_lua_function ("test", script, lsp);
                } catch (SessionException e) {
-                       CPPUNIT_FAIL ("Cannot add script to session");
+                       CPPUNIT_FAIL (spi->name + ": Cannot add script to session");
                        continue;
                }
-               CPPUNIT_ASSERT (!_session->registered_lua_functions ().empty());
+               CPPUNIT_ASSERT_MESSAGE (spi->name, !_session->registered_lua_functions ().empty());
                Glib::usleep(200000); // wait to script to execute during process()
                // if the script fails, it'll be removed.
-               CPPUNIT_ASSERT (!_session->registered_lua_functions ().empty());
+               CPPUNIT_ASSERT_MESSAGE (spi->name, !_session->registered_lua_functions ().empty());
                _session->unregister_lua_function ("test");
-               CPPUNIT_ASSERT (_session->registered_lua_functions ().empty());
+               CPPUNIT_ASSERT_MESSAGE (spi->name, _session->registered_lua_functions ().empty());
        }
 }
 
@@ -66,16 +72,8 @@ LuaScriptTest::dsp_script_test ()
        std::cout << "\n";
        const PluginInfoList& plugs = pm.lua_plugin_info();
        for (PluginInfoList::const_iterator i = plugs.begin(); i != plugs.end(); ++i) {
-               std::cout << "LuaProc: " <<(*i)->name << "\n";
-
-               PluginPtr p = (*i)->load (*_session);
-               CPPUNIT_ASSERT_MESSAGE ((*i)->name, p);
-
-               boost::shared_ptr<Processor> processor (new PluginInsert (*_session, p));
-               processor->enable (true);
 
                if (Glib::path_get_basename ((*i)->path).find ("__") == 0) {
-                       std::cout << " .. skip processing test\n";
                        /* Example scripts (filename with leading underscore), that
                         * use a double-underscore at the beginning of the file-name
                         * are excluded from unit-tests (e.g. "Lua Convolver"
@@ -84,6 +82,18 @@ LuaScriptTest::dsp_script_test ()
                        continue;
                }
 
+               if (Glib::path_get_basename ((*i)->path).at(0) == '_') {
+                       std::cout << "LuaProc: " <<(*i)->name << " (not bundled)\n";
+               } else {
+                       std::cout << "LuaProc: " <<(*i)->name << "\n";
+               }
+
+               PluginPtr p = (*i)->load (*_session);
+               CPPUNIT_ASSERT_MESSAGE ((*i)->name, p);
+
+               boost::shared_ptr<Processor> processor (new PluginInsert (*_session, p));
+               processor->enable (true);
+
                int rv = r->add_processor (processor, boost::shared_ptr<Processor>(), 0);
                CPPUNIT_ASSERT_MESSAGE ((*i)->name, rv == 0);
                processor->enable (true);