diff options
author | est31 <MTest31@outlook.com> | 2015-10-26 04:13:27 +0100 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-10-26 04:45:00 +0100 |
commit | 5f342aa0154e59503fbb22e46ac95ef655aaad1a (patch) | |
tree | b476f7a5e4d7b4f09ecd514af2c82484e5f8c132 | |
parent | d69ef6acd386ccfd5ff456002591b97b92a26956 (diff) | |
download | minetest-5f342aa0154e59503fbb22e46ac95ef655aaad1a.tar.gz minetest-5f342aa0154e59503fbb22e46ac95ef655aaad1a.tar.bz2 minetest-5f342aa0154e59503fbb22e46ac95ef655aaad1a.zip |
Remove some abort() calls
abort() doesn't benefit from the high level abstractions from FATAL_ERROR.
-rw-r--r-- | src/main.cpp | 3 | ||||
-rw-r--r-- | src/script/cpp_api/s_async.cpp | 10 | ||||
-rw-r--r-- | src/unittest/test.cpp | 5 | ||||
-rw-r--r-- | src/unittest/test.h | 2 |
4 files changed, 7 insertions, 13 deletions
diff --git a/src/main.cpp b/src/main.cpp index 1538c15d4..1fa9243fa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -183,8 +183,7 @@ int main(int argc, char *argv[]) #ifndef __ANDROID__ // Run unit tests if (cmd_args.getFlag("run-unittests")) { - run_tests(); - return 0; + return run_tests(); } #endif diff --git a/src/script/cpp_api/s_async.cpp b/src/script/cpp_api/s_async.cpp index d18ff6e8c..171632633 100644 --- a/src/script/cpp_api/s_async.cpp +++ b/src/script/cpp_api/s_async.cpp @@ -244,17 +244,14 @@ void* AsyncWorkerThread::run() std::string script = getServer()->getBuiltinLuaPath() + DIR_DELIM + "init.lua"; if (!loadScript(script)) { - errorstream << "execution of async base environment failed!" - << std::endl; - abort(); + FATAL_ERROR("execution of async base environment failed!"); } int error_handler = PUSH_ERROR_HANDLER(L); lua_getglobal(L, "core"); if (lua_isnil(L, -1)) { - errorstream << "Unable to find core within async environment!"; - abort(); + FATAL_ERROR("Unable to find core within async environment!"); } // Main loop @@ -268,8 +265,7 @@ void* AsyncWorkerThread::run() lua_getfield(L, -1, "job_processor"); if (lua_isnil(L, -1)) { - errorstream << "Unable to get async job processor!" << std::endl; - abort(); + FATAL_ERROR("Unable to get async job processor!"); } luaL_checktype(L, -1, LUA_TFUNCTION); diff --git a/src/unittest/test.cpp b/src/unittest/test.cpp index 1f3b31017..41ccf0d2d 100644 --- a/src/unittest/test.cpp +++ b/src/unittest/test.cpp @@ -215,7 +215,7 @@ void TestGameDef::defineSomeNodes() //// run_tests //// -void run_tests() +bool run_tests() { DSTACK(FUNCTION_NAME); @@ -253,8 +253,7 @@ void run_tests() << "++++++++++++++++++++++++++++++++++++++++" << "++++++++++++++++++++++++++++++++++++++++" << std::endl; - if (num_modules_failed) - abort(); + return num_modules_failed; } //// diff --git a/src/unittest/test.h b/src/unittest/test.h index f6c4711a5..e60e657cc 100644 --- a/src/unittest/test.h +++ b/src/unittest/test.h @@ -142,6 +142,6 @@ extern content_t t_CONTENT_WATER; extern content_t t_CONTENT_LAVA; extern content_t t_CONTENT_BRICK; -void run_tests(); +bool run_tests(); #endif |