tester: allow launch of tests from outside of tester/ directory

parent 268a419f
......@@ -70,16 +70,16 @@ _liblinphone_complete() {
# if latest arg does not start with '--', it is a custom value
if [ $latest_is_empty = 0 ] && ! grep -q -- '^--' <<< "$latest_arg"; then
# echo "yes!$prev_arg $has_not_set_suite"
if [ "$prev_arg" = "--test" ] && [ $has_not_set_suite = 0 ]; then
suite_name=$(echo $@ | sed -nE 's/.*--suite (.*) (--.*)$/\1/p' |sed "s@\\\\@@g")
suite_name=$(echo $@ | sed -nE 's/.*--suite ([^(--)]*) (--.*)$/\1/p' |sed "s@\\\\@@g")
completions="$($program --list-tests $suite_name)"
elif [ "$prev_arg" = "--suite" ] || [ "$prev_arg" = "--list-tests" ]; then
completions="$($program --list-suites)"
fi
elif [ "$latest_arg" = "--test" ]; then
# list available tests if --suite was provided
if [ $has_not_set_suite = 0 ]; then
suite_name=$(echo $@ | sed -nE 's/.*--suite (.*) (--.*)$/\1/p' |sed "s@\\\\@@g")
suite_name=$(echo $@ | sed -nE 's/.*--suite ([^(--)]*) (--.*)/\1/p' |sed "s@\\\\@@g")
completions="$($program --list-tests $suite_name)"
fi
elif [ "$latest_arg" = "--suite" ] || [ "$latest_arg" = "--list-tests" ]; then
......
......@@ -89,6 +89,14 @@ int main (int argc, char *argv[]) {
mediastreamer2_tester_init(NULL);
{
char res_dir[128] = {0};
// this allows to launch liblinphone_tester from outside of tester directory
strncpy(res_dir, argv[0], strstr(argv[0], ".libs")-argv[0]);
bc_tester_set_resource_dir_prefix(res_dir);
bc_tester_set_writable_dir_prefix(res_dir);
}
for(i = 1; i < argc; ++i) {
if (strcmp(argv[i], "--verbose") == 0) {
ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment