hrev43406 adds 1 changeset to branch 'master' old head: 2872aba0a779d4b4fceeaaa34c45be58a5b70e66 new head: 80abc6322cdf826575fae60ccd6ce89c9444a55c ---------------------------------------------------------------------------- 80abc63: Fall back to running test_registrar from the same directory. As a last fall-back, try to launch the test_registrar from the same directory as run_test_registrar. This makes launching the app_server test environment from a volume without Query support work. [ Stephan Aßmus <superstippi@xxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev43406 Commit: 80abc6322cdf826575fae60ccd6ce89c9444a55c URL: http://cgit.haiku-os.org/haiku/commit/?id=80abc63 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Sun Dec 4 17:17:20 2011 UTC ---------------------------------------------------------------------------- 1 files changed, 33 insertions(+), 17 deletions(-) src/tests/servers/registrar/run_test_registrar.cpp | 50 ++++++++++----- ---------------------------------------------------------------------------- diff --git a/src/tests/servers/registrar/run_test_registrar.cpp b/src/tests/servers/registrar/run_test_registrar.cpp index 8c626da..20cf63b 100644 --- a/src/tests/servers/registrar/run_test_registrar.cpp +++ b/src/tests/servers/registrar/run_test_registrar.cpp @@ -4,29 +4,46 @@ */ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + #include <OS.h> #include <image.h> #include <Entry.h> #include <Query.h> #include <Path.h> +#include <String.h> #include <Volume.h> #include <fs_info.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - extern const char* __progname; +static status_t +launch_registrar(const char* registrarPath) +{ + const char* args[] = { registrarPath, NULL }; + thread_id thread = load_image(1, args, (const char**)environ); + if (thread < B_OK) { + fprintf(stderr, "%s: Could not start the registrar: %s\n", + __progname, strerror(thread)); + return (status_t)thread; + } + + return resume_thread(thread); +} + + int -main() +main(int argc, char* argv[]) { team_info teamInfo; int32 cookie = 0; while (get_next_team_info(&cookie, &teamInfo) == B_OK) { - if (!strncmp(teamInfo.args, "/boot/beos/", 11)) { + if (!strncmp(teamInfo.args, "/boot/beos/", 11) + || !strncmp(teamInfo.args, "/boot/system/", 13)) { // this is a system component and not worth to investigate continue; } @@ -75,23 +92,22 @@ main() if (!strncmp(currentPath.Path(), registrarPath, generatedPath - registrarPath)) { // gotcha! - const char* args[] = { registrarPath, NULL }; - thread_id thread = load_image(1, args, (const char**)environ); - if (thread < B_OK) { - fprintf(stderr, "%s: Could not start the registrar: %s\n", - __progname, strerror(thread)); - return -1; - } - - resume_thread(thread); - return 0; + if (launch_registrar(registrarPath) == B_OK) + return 0; } } + // As a fallback (maybe the volume does not support queries for example) + // try to find the test_registrar in the current folder... + BString registrarPath(argv[0]); + registrarPath.RemoveLast(__progname); + registrarPath.Append("test_registrar"); + if (launch_registrar(registrarPath.String()) == B_OK) + return 0; + fprintf(stderr, "%s: Could not find the Haiku Registrar.\n" " (This tool only works when used in the Haiku tree, but maybe\n" " the registrar just needs to be built.)\n", __progname); return -1; } -