From 8124917b6330d2b94bbfd734cb8929759a75d6ab Mon Sep 17 00:00:00 2001
From: Philippe SWARTVAGHER <philippe.swartvagher@inria.fr>
Date: Wed, 31 Jul 2024 10:49:17 +0200
Subject: [PATCH] testing: display in help possible values for several options

And add short aliases for norm option
---
 testing/chameleon_ztesting.c | 18 +++++++++---------
 testing/values.c             | 19 +++++++++++++++----
 testing/vendor_ztesting.c    | 14 +++++++-------
 3 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/testing/chameleon_ztesting.c b/testing/chameleon_ztesting.c
index bbe4d20ea..9cfa979af 100644
--- a/testing/chameleon_ztesting.c
+++ b/testing/chameleon_ztesting.c
@@ -104,13 +104,13 @@ parameter_t parameters[] = {
 #endif
 
     { NULL, "Operation specific parameters", 0, PARAM_OPTION, 0, 0, 0, {0}, NULL, NULL, NULL },
-    { "trans",  "Value of the trans parameter",  -11, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 9, TestTrans,    {0}, NULL, pread_trans, sprint_trans },
-    { "transA", "Value of the transA parameter", -12, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 9, TestTrans,    {0}, NULL, pread_trans, sprint_trans },
-    { "transB", "Value of the transB parameter", -13, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 9, TestTrans,    {0}, NULL, pread_trans, sprint_trans },
-    { "uplo",   "Value of the uplo parameter",   -14, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 7, TestUplo,     {0}, NULL, pread_uplo,  sprint_uplo  },
-    { "diag",   "Value of the diag parameter",   -15, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 7, TestDiag,     {0}, NULL, pread_diag,  sprint_diag  },
-    { "side",   "Value of the side parameter",   -16, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 5, TestSide,     {0}, NULL, pread_side,  sprint_side  },
-    { "norm",   "Value of the norm parameter",   -17, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 4, TestNormtype, {0}, NULL, pread_norm,  sprint_norm  },
+    { "trans",  "Value of the trans parameter ('ConjTrans', 'Trans', 'NoTrans')",  -11, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 9, TestTrans,    {0}, NULL, pread_trans, sprint_trans },
+    { "transA", "Value of the transA parameter ('ConjTrans', 'Trans', 'NoTrans')", -12, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 9, TestTrans,    {0}, NULL, pread_trans, sprint_trans },
+    { "transB", "Value of the transB parameter ('ConjTrans', 'Trans', 'NoTrans')", -13, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 9, TestTrans,    {0}, NULL, pread_trans, sprint_trans },
+    { "uplo",   "Value of the uplo parameter ('Upper', 'Lower', 'UpperLower')",   -14, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 7, TestUplo,     {0}, NULL, pread_uplo,  sprint_uplo  },
+    { "diag",   "Value of the diag parameter ('NonUnit', 'Unit')",   -15, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 7, TestDiag,     {0}, NULL, pread_diag,  sprint_diag  },
+    { "side",   "Value of the side parameter ('Left', 'Right')",   -16, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 5, TestSide,     {0}, NULL, pread_side,  sprint_side  },
+    { "norm",   "Value of the norm parameter ('One', 'Frobenius', 'Inf', 'Max')",   -17, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 4, TestNormtype, {0}, NULL, pread_norm,  sprint_norm  },
 
     { NULL, "Operation specific scalar", 0, PARAM_OPTION, 0, 0, 0, {0}, NULL, NULL, NULL },
     { "alpha", "Value of the scalar alpha",                       'x', PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 13, TestValComplex64, {0}, NULL, pread_complex64, sprint_complex64 },
@@ -125,8 +125,8 @@ parameter_t parameters[] = {
     { "domino", "Enable/Disable the domino between upper and lower trees", -24, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 6, TestValInt, {0}, NULL, pread_int, sprint_int },
 
     { NULL, "SVD parameters", 0, PARAM_OPTION, 0, 0, 0, {0}, NULL, NULL, NULL },
-    { "jobu",  "Value of the jobu parameter",  -50, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 4, TestJob, {0}, NULL, pread_job, sprint_job },
-    { "jobvt", "Value of the jobvt parameter", -51, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 5, TestJob, {0}, NULL, pread_job, sprint_job },
+    { "jobu",  "Value of the jobu parameter ('NoVec', 'Vec', 'Ivec', 'AllVec', 'SVec', 'OVec')",  -50, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 4, TestJob, {0}, NULL, pread_job, sprint_job },
+    { "jobvt", "Value of the jobvt parameter ('NoVec', 'Vec', 'Ivec', 'AllVec', 'SVec', 'OVec')", -51, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 5, TestJob, {0}, NULL, pread_job, sprint_job },
 #endif
 
     { "tsub",          "Graph submission time in s",             999, PARAM_OUTPUT, 2, 13, TestValFixdbl, {0}, NULL, pread_fixdbl, sprint_fixdbl },
diff --git a/testing/values.c b/testing/values.c
index 66520f5f1..7b8f4da7d 100644
--- a/testing/values.c
+++ b/testing/values.c
@@ -122,6 +122,7 @@ val_t pread_trans( const char *str )
     val_t val;
     val.trans = ChamNoTrans;
 
+    /* Keep in sync with help documentation in testing/{chameleon,vendor}_ztesting.c */
     if ( ( strcasecmp( "ChamConjTrans", str ) == 0 ) ||
          ( strcasecmp( "ConjTrans", str ) == 0 ) )
     {
@@ -163,6 +164,7 @@ val_t pread_uplo( const char *str )
     val_t val;
     val.uplo = ChamUpperLower;
 
+    /* Keep in sync with help documentation in testing/{chameleon,vendor}_ztesting.c */
     if ( ( strcasecmp( "ChamUpper", str ) == 0 ) ||
          ( strcasecmp( "Upper",     str ) == 0 ) )
     {
@@ -205,6 +207,7 @@ val_t pread_diag( const char *str )
     val_t val;
     val.diag = ChamNonUnit;
 
+    /* Keep in sync with help documentation in testing/{chameleon,vendor}_ztesting.c */
     if ( ( strcasecmp( "ChamNonUnit", str ) == 0 ) ||
          ( strcasecmp( "NonUnit",     str ) == 0 ) )
     {
@@ -238,6 +241,7 @@ val_t pread_side( const char *str )
     val_t val;
     val.side = ChamLeft;
 
+    /* Keep in sync with help documentation in testing/{chameleon,vendor}_ztesting.c */
     if ( ( strcasecmp( "ChamLeft", str ) == 0 ) ||
          ( strcasecmp( "Left",     str ) == 0 ) )
     {
@@ -271,6 +275,7 @@ val_t pread_job( const char *str )
     val_t val;
     val.job = ChamNoVec;
 
+    /* Keep in sync with help documentation in testing/chameleon_ztesting.c */
     if ( ( strcasecmp( "ChamNoVec", str ) == 0 ) ||
          ( strcasecmp( "NoVec",     str ) == 0 ) ||
          ( strcasecmp( "N",         str ) == 0 ) )
@@ -341,23 +346,29 @@ val_t pread_norm( const char *str )
     val_t val;
     val.ntype = ChamOneNorm;
 
+    /* Keep in sync with help documentation in testing/{chameleon,vendor}_ztesting.c */
     if ( ( strcasecmp( "ChamOneNorm", str ) == 0 ) ||
-         ( strcasecmp( "OneNorm",     str ) == 0 ) )
+         ( strcasecmp( "OneNorm",     str ) == 0 ) ||
+         ( strcasecmp( "One",         str ) == 0 ) )
     {
         val.ntype = ChamOneNorm;
     }
     else if ( ( strcasecmp( "ChamFrobeniusNorm", str ) == 0 ) ||
-              ( strcasecmp( "FrobeniusNorm",     str ) == 0 ) )
+              ( strcasecmp( "FrobeniusNorm",     str ) == 0 ) ||
+              ( strcasecmp( "Frobenius",         str ) == 0 ) ||
+              ( strcasecmp( "Fro",               str ) == 0 ) )
     {
         val.ntype = ChamFrobeniusNorm;
     }
     else if ( ( strcasecmp( "ChamInfNorm", str ) == 0 ) ||
-              ( strcasecmp( "InfNorm",     str ) == 0 ) )
+              ( strcasecmp( "InfNorm",     str ) == 0 ) ||
+              ( strcasecmp( "Inf",         str ) == 0 ) )
     {
         val.ntype = ChamInfNorm;
     }
     else if ( ( strcasecmp( "ChamMaxNorm", str ) == 0 ) ||
-              ( strcasecmp( "MaxNorm",     str ) == 0 ) )
+              ( strcasecmp( "MaxNorm",     str ) == 0 ) ||
+              ( strcasecmp( "Max",         str ) == 0 ) )
     {
         val.ntype = ChamMaxNorm;
     }
diff --git a/testing/vendor_ztesting.c b/testing/vendor_ztesting.c
index 44de9de5c..72b484b21 100644
--- a/testing/vendor_ztesting.c
+++ b/testing/vendor_ztesting.c
@@ -68,13 +68,13 @@ parameter_t parameters[] = {
     { "cond",  "Conditional number of the matrix used by xlatms",         -41, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 13, TestValDouble,    {0}, NULL, pread_double,    sprint_double    },
 
     { NULL, "Operation specific parameters", 0, PARAM_OPTION, 0, 0, 0, {0}, NULL, NULL, NULL },
-    { "trans",  "Value of the trans parameter",  -11, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 9, TestTrans,    {0}, NULL, pread_trans, sprint_trans },
-    { "transA", "Value of the transA parameter", -12, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 9, TestTrans,    {0}, NULL, pread_trans, sprint_trans },
-    { "transB", "Value of the transB parameter", -13, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 9, TestTrans,    {0}, NULL, pread_trans, sprint_trans },
-    { "uplo",   "Value of the uplo parameter",   -14, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 7, TestUplo,     {0}, NULL, pread_uplo,  sprint_uplo  },
-    { "diag",   "Value of the diag parameter",   -15, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 7, TestDiag,     {0}, NULL, pread_diag,  sprint_diag  },
-    { "side",   "Value of the side parameter",   -16, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 5, TestSide,     {0}, NULL, pread_side,  sprint_side  },
-    { "norm",   "Value of the norm parameter",   -17, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 4, TestNormtype, {0}, NULL, pread_norm,  sprint_norm  },
+    { "trans",  "Value of the trans parameter ('ConjTrans', 'Trans', 'NoTrans')",  -11, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 9, TestTrans,    {0}, NULL, pread_trans, sprint_trans },
+    { "transA", "Value of the transA parameter ('ConjTrans', 'Trans', 'NoTrans')", -12, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 9, TestTrans,    {0}, NULL, pread_trans, sprint_trans },
+    { "transB", "Value of the transB parameter ('ConjTrans', 'Trans', 'NoTrans')", -13, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 9, TestTrans,    {0}, NULL, pread_trans, sprint_trans },
+    { "uplo",   "Value of the uplo parameter ('Upper', 'Lower', 'UpperLower')",   -14, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 7, TestUplo,     {0}, NULL, pread_uplo,  sprint_uplo  },
+    { "diag",   "Value of the diag parameter ('NonUnit', 'Unit')",   -15, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 7, TestDiag,     {0}, NULL, pread_diag,  sprint_diag  },
+    { "side",   "Value of the side parameter ('Left', 'Right')",   -16, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 5, TestSide,     {0}, NULL, pread_side,  sprint_side  },
+    { "norm",   "Value of the norm parameter ('One', 'Frobenius', 'Inf', 'Max')",   -17, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 4, TestNormtype, {0}, NULL, pread_norm,  sprint_norm  },
 
     { NULL, "Operation specific scalar", 0, PARAM_OPTION, 0, 0, 0, {0}, NULL, NULL, NULL },
     { "alpha", "Value of the scalar alpha",                       'x', PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 13, TestValComplex64, {0}, NULL, pread_complex64, sprint_complex64 },
-- 
GitLab