[med-svn] [Git][med-team/bart][master] add patch to fix tests
Martin Uecker (@uecker-guest)
gitlab at salsa.debian.org
Thu Dec 7 15:20:36 GMT 2023
Martin Uecker pushed to branch master at Debian Med / bart
Commits:
82b67b86 by Martin Uecker at 2023-12-07T16:20:16+01:00
add patch to fix tests
- - - - -
3 changed files:
- debian/changelog
- + debian/patches/0008-fix-command-line-processing.patch
- debian/patches/series
Changes:
=====================================
debian/changelog
=====================================
@@ -1,6 +1,7 @@
bart (0.9.00-1) UNRELEASED; urgency=medium
* New upstream version.
+ * Add patch to fix cli processing in testsuite.
-- Martin Uecker <uecker at tugraz.at> Thu, 07 Dec 2023 10:22:14 +0100
=====================================
debian/patches/0008-fix-command-line-processing.patch
=====================================
@@ -0,0 +1,183 @@
+From: Martin Uecker <uecker at tugraz.at>
+Date: Thu, 7 Dec 2023 14:15:15 +0100
+Subject: fix command-line processing
+
+---
+ src/bart.c | 55 ++++++++++++++++++++++---------------------------------
+ src/misc/opts.c | 6 ++----
+ 2 files changed, 24 insertions(+), 37 deletions(-)
+
+diff --git a/src/bart.c b/src/bart.c
+index 84db732..a77fb0a 100644
+--- a/src/bart.c
++++ b/src/bart.c
+@@ -129,7 +129,7 @@ static int bart_exit(int err_no, const char* exit_msg)
+ }
+
+
+-static bool parse_bart_opts(int* argcp, char*** argvp)
++static void parse_bart_opts(int* argcp, char*** argvp)
+ {
+ int omp_threads = 1;
+ unsigned long flags = 0;
+@@ -155,15 +155,6 @@ static bool parse_bart_opts(int* argcp, char*** argvp)
+
+ int next_arg = options(argcp, *argvp, "", help_str, ARRAY_SIZE(opts), opts, ARRAY_SIZE(args), args, true);
+
+- if ((1 == *argcp) || (next_arg == *argcp) || (NULL == (*argvp)[next_arg])) {
+- // bart was called without any options
+-
+- print_usage(stdout, (*argvp)[0], "...", ARRAY_SIZE(opts), opts);
+- usage();
+-
+- return true;
+- }
+-
+ *argcp -= next_arg;
+ *argvp += next_arg;
+
+@@ -253,7 +244,6 @@ static bool parse_bart_opts(int* argcp, char*** argvp)
+ omp_threads = 1;
+
+ init_cfl_loop_desc(DIMS, loop_dims, offs_size, flags, omp_threads, 0);
+- return false;
+ }
+
+
+@@ -284,24 +274,35 @@ static int batch_wrapper(main_fun_t* dispatch_func, int argc, char *argv[argc],
+
+ int main_bart(int argc, char* argv[argc])
+ {
++ char* bn = basename(argv[0]);
++
++ // only skip over initial bart or bart.exe. calling "bart bart" is an error.
++ if (0 == strcmp(bn, "bart") || 0 == strcmp(bn, "bart.exe")) {
+
+- // This advances argv to behind the bart options
+- bool no_arguments = parse_bart_opts(&argc, &argv);
+- if (no_arguments)
+- return 1;
++ if (1 == argc) {
++
++ usage();
++ return -1;
++ }
++
++ // This advances argv to behind the bart options
++ parse_bart_opts(&argc, &argv);
++
++ bn = basename(argv[0]);
++ }
+
+
+ main_fun_t* dispatch_func = NULL;
+
+ for (int i = 0; NULL != dispatch_table[i].name; i++)
+- if (0 == strcmp(argv[0], dispatch_table[i].name))
++ if (0 == strcmp(bn, dispatch_table[i].name))
+ dispatch_func = dispatch_table[i].main_fun;
+
+ bool builtin_found = (NULL != dispatch_func);
+
+ if (builtin_found) {
+
+- debug_printf(DP_DEBUG3, "Builtin found: %s\n", argv[0]);
++ debug_printf(DP_DEBUG3, "Builtin found: %s\n", bn);
+
+ unsigned int v[5];
+ version_parse(v, bart_version);
+@@ -346,8 +347,6 @@ int main_bart(int argc, char* argv[argc])
+
+ return final_ret;
+
+-
+-
+ } else {
+ // could not find any builtin
+ // try to find something in commands
+@@ -370,7 +369,6 @@ int main_bart(int argc, char* argv[argc])
+ }
+ #endif
+
+-
+ const char* tpath[] = {
+ #ifdef CHECK_EXE_COMMANDS
+ exe_dir,
+@@ -381,26 +379,16 @@ int main_bart(int argc, char* argv[argc])
+ "/usr/lib/bart/",
+ };
+
+- // skip over "bart" or "bart.exe"
+- int offset = 0;
+- char* bn = basename(argv[0]);
+-
+- // only skip over initial bart or bart.exe. calling "bart bart" is an error.
+- if (0 == strcmp(bn, "bart") || 0 == strcmp(bn, "bart.exe"))
+- offset = 1;
+-
+- bn = basename(argv[offset]);
+-
+ for (int i = 0; i < (int)ARRAY_SIZE(tpath); i++) {
+
+ if (NULL == tpath[i])
+ continue;
+
+- size_t len = strlen(tpath[i]) + strlen(argv[offset]) + 10 + 1; // extra space for /commands/ and null-terminator
++ size_t len = strlen(tpath[i]) + strlen(bn) + 10 + 1; // extra space for /commands/ and null-terminator
+
+ char (*cmd)[len] = xmalloc(sizeof *cmd);
+
+- int r = snprintf(*cmd, len, "%s/commands/%s", tpath[i], argv[offset]);
++ int r = snprintf(*cmd, len, "%s/commands/%s", tpath[i], bn);
+
+ if (r >= (int)len) {
+
+@@ -410,7 +398,7 @@ int main_bart(int argc, char* argv[argc])
+
+ debug_printf(DP_DEBUG3, "Trying: %s\n", cmd);
+
+- if (-1 == execv(*cmd, argv + offset)) {
++ if (-1 == execv(*cmd, argv)) {
+
+ if (ENOENT != errno) {
+
+@@ -428,6 +416,7 @@ int main_bart(int argc, char* argv[argc])
+ }
+
+ fprintf(stderr, "Unknown bart command: \"%s\".\n", bn);
++
+ return bart_exit(-1, NULL);
+ }
+ }
+diff --git a/src/misc/opts.c b/src/misc/opts.c
+index ac2ed4c..64029a2 100644
+--- a/src/misc/opts.c
++++ b/src/misc/opts.c
+@@ -548,7 +548,6 @@ int options(int* argcp, char* argv[*argcp], const char* usage_str, const char* h
+ debug_printf(DP_INFO, "opt: %d: %s: %d\n",i, wopts[i].descr, (int) wopts[i].c);
+ #endif
+
+-
+ int next_opt = 0;
+ #pragma omp critical(bart_getopt)
+ {
+@@ -560,6 +559,7 @@ int options(int* argcp, char* argv[*argcp], const char* usage_str, const char* h
+ int l = 0;
+ if (stop_at_nonopt)
+ optstr[l++] = '+';
++
+ optstr[l++] = 'h';
+
+ for (int i = 0; i < n; i++) {
+@@ -575,10 +575,8 @@ int options(int* argcp, char* argv[*argcp], const char* usage_str, const char* h
+ int c;
+ int longindex = -1;
+
+- while (-1 != (c = ya_getopt_long(argc, argv, optstr, longopts, &longindex))) {
+-
++ while (-1 != (c = ya_getopt_long(argc, argv, optstr, longopts, &longindex)))
+ process_option(c, optarg, argv[0], usage_str, help_str, n, wopts, m, args);
+- }
+
+ next_opt = optind;
+ }
=====================================
debian/patches/series
=====================================
@@ -5,3 +5,4 @@
0006-on-Deban-never-use-git-version.patch
0007-add-CXXFLAGS-to-nvcc-to-fix-C-build-issue.patch
0010-turn-off-one-test-on-i386.patch
+0008-fix-command-line-processing.patch
View it on GitLab: https://salsa.debian.org/med-team/bart/-/commit/82b67b8606084e96c6cc447e5bf6af5671146288
--
View it on GitLab: https://salsa.debian.org/med-team/bart/-/commit/82b67b8606084e96c6cc447e5bf6af5671146288
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20231207/d3bec9da/attachment-0001.htm>
More information about the debian-med-commit
mailing list