From b6d517161b6f5dcdc1f9b3206e2428b83cf98fe3 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Wed, 17 Apr 2019 07:56:56 +0000
Subject: [PATCH] add short test for gdat tcv calls returning 1 if ok

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@11767 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx/test_all_requestnames.m | 22 +++++++++++++---------
 crpptbx/test_gdat_tcv_short.m   | 12 ++++++++++++
 2 files changed, 25 insertions(+), 9 deletions(-)
 create mode 100644 crpptbx/test_gdat_tcv_short.m

diff --git a/crpptbx/test_all_requestnames.m b/crpptbx/test_all_requestnames.m
index ad8db3ef..273aada5 100644
--- a/crpptbx/test_all_requestnames.m
+++ b/crpptbx/test_all_requestnames.m
@@ -7,7 +7,7 @@ function [pass,request_list,err,telaps,skipped,gdat_results] = test_all_requestn
 %  pass = test_all_requestnames('param1',value1,'param2',value2,...); %
 %    INPUT PARAMETERS (optional)
 %       machine: string of machine name (e.g. 'aug'). (default: gdat internal default)
-%       testmode: depth of test: 'reduced' or 'full' (default: 'reduced')
+%       testmode: depth of test: 'reduced' or 'full' (default: 'reduced') or cell array of requests to test
 %       nverbose: 0 for silent, 1 for text, 2 for plots (default: 1)
 %    OUTPUTS
 %       pass: single boolean indicating pass/fail of test
@@ -46,13 +46,17 @@ switch upper(machine)
 end
 
 %% possibly skip some since they take too long for a reduced test
-switch testmode
- case 'reduced'
-  skip = skip_list(machine);
- case 'full'
-  skip = ''; % skip none
- otherwise
-  error('invalid testmode, should be ''reduced'' or ''full''');
+if iscell(testmode)
+  skip = setdiff(request_list,testmode);
+else
+  switch testmode
+   case 'reduced'
+    skip = skip_list(machine);
+   case 'full'
+    skip = ''; % skip none
+   otherwise
+    error('invalid testmode, should be ''reduced'' or ''full''');
+  end
 end
 
 %% init
@@ -84,7 +88,7 @@ for ireq = 1:Nreq
     err(ireq) = 0;
     telaps(ireq) = 0;
     skipped(ireq) = true;
-    fprintf('\n skipping gdat request ''%s''\n',myrequest)
+    if nverbose>=1; fprintf('\n skipping gdat request ''%s''\n',myrequest); end
   end
 end
 
diff --git a/crpptbx/test_gdat_tcv_short.m b/crpptbx/test_gdat_tcv_short.m
new file mode 100644
index 00000000..95da4ab5
--- /dev/null
+++ b/crpptbx/test_gdat_tcv_short.m
@@ -0,0 +1,12 @@
+function [pass] = test_gdat_tcv_short
+%
+% [pass] = test_gdat_tcv_short
+%
+% tests a few signals
+%
+%       pass: single boolean indicating pass/fail of test
+%
+
+test_machine = 'tcv';
+test_signals = {'ip', 'q_rho'};
+[pass,request_list,err,telaps,skipped,gdat_results] = test_all_requestnames('machine',test_machine,'testmode',test_signals,'nverbose',0);
-- 
GitLab