aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-01-16 18:55:33 +0100
committerChristian Grothoff <christian@grothoff.org>2021-01-16 18:55:33 +0100
commit1fd0f9db27afc2fd4929b5b84529c21100f671f2 (patch)
treed9d29288b755f1b6ea77f96e8eadc3d17f25395d
parent184f6b151c2087a9870b32eab45b101ba79973d9 (diff)
downloadgnunet-1fd0f9db27afc2fd4929b5b84529c21100f671f2.tar.gz
gnunet-1fd0f9db27afc2fd4929b5b84529c21100f671f2.zip
fix config test
-rw-r--r--src/util/test_configuration.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/util/test_configuration.c b/src/util/test_configuration.c
index 59b1b2291..823bf273d 100644
--- a/src/util/test_configuration.c
+++ b/src/util/test_configuration.c
@@ -70,12 +70,17 @@ initDiffsCBData (struct DiffsCBData *cbData)
70 * and comparing configuration 70 * and comparing configuration
71 */ 71 */
72static void 72static void
73diffsCallBack (void *cls, const char *section, const char *option, 73diffsCallBack (void *cls,
74 const char *section,
75 const char *option,
74 const char *value) 76 const char *value)
75{ 77{
76 struct DiffsCBData *cbData = cls; 78 struct DiffsCBData *cbData = cls;
77 int cbOption = cbData->callBackOption; 79 int cbOption = cbData->callBackOption;
78 80
81 if (0 == strcasecmp ("PATHS",
82 section))
83 return;
79 switch (cbOption) 84 switch (cbOption)
80 { 85 {
81 case EDIT_SECTION: 86 case EDIT_SECTION:
@@ -89,14 +94,12 @@ diffsCallBack (void *cls, const char *section, const char *option,
89 "new-value"); 94 "new-value");
90 } 95 }
91 break; 96 break;
92
93 case EDIT_ALL: 97 case EDIT_ALL:
94 GNUNET_CONFIGURATION_set_value_string (cbData->cfg, section, option, 98 GNUNET_CONFIGURATION_set_value_string (cbData->cfg, section, option,
95 "new-value"); 99 "new-value");
96 GNUNET_CONFIGURATION_set_value_string (cbData->cfgDiffs, section, option, 100 GNUNET_CONFIGURATION_set_value_string (cbData->cfgDiffs, section, option,
97 "new-value"); 101 "new-value");
98 break; 102 break;
99
100 case ADD_NEW_ENTRY: 103 case ADD_NEW_ENTRY:
101 { 104 {
102 static int hit = 0; 105 static int hit = 0;
@@ -111,7 +114,6 @@ diffsCallBack (void *cls, const char *section, const char *option,
111 } 114 }
112 break; 115 break;
113 } 116 }
114
115 case COMPARE: 117 case COMPARE:
116 { 118 {
117 int ret; 119 int ret;
@@ -119,15 +121,32 @@ diffsCallBack (void *cls, const char *section, const char *option,
119 121
120 diffValue = NULL; 122 diffValue = NULL;
121 ret = 123 ret =
122 GNUNET_CONFIGURATION_get_value_string (cbData->cfgDiffs, section, 124 GNUNET_CONFIGURATION_get_value_string (cbData->cfgDiffs,
123 option, &diffValue); 125 section,
126 option,
127 &diffValue);
124 if (NULL != diffValue) 128 if (NULL != diffValue)
125 { 129 {
126 if ((ret == GNUNET_SYSERR) || (strcmp (diffValue, value) != 0) ) 130 if ( (ret == GNUNET_SYSERR) ||
131 (strcmp (diffValue, value) != 0) )
132 {
133 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
134 "Unexpected value %s in %s/%s\n",
135 diffValue,
136 section,
137 option);
127 cbData->status = 1; 138 cbData->status = 1;
139 }
128 } 140 }
129 else 141 else
142 {
143 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
144 "Unexpected value %s in %s/%s\n",
145 diffValue,
146 section,
147 option);
130 cbData->status = 1; 148 cbData->status = 1;
149 }
131 GNUNET_free (diffValue); 150 GNUNET_free (diffValue);
132 break; 151 break;
133 } 152 }
@@ -153,7 +172,8 @@ diffsCallBack (void *cls, const char *section, const char *option,
153 172
154 173
155static struct GNUNET_CONFIGURATION_Handle * 174static struct GNUNET_CONFIGURATION_Handle *
156editConfiguration (struct GNUNET_CONFIGURATION_Handle *cfg, int option) 175editConfiguration (struct GNUNET_CONFIGURATION_Handle *cfg,
176 int option)
157{ 177{
158 struct DiffsCBData diffsCB; 178 struct DiffsCBData diffsCB;
159 179
@@ -244,7 +264,9 @@ checkDiffs (struct GNUNET_CONFIGURATION_Handle *cfg_default, int option)
244 diffsFileName); 264 diffsFileName);
245 cbData.callBackOption = COMPARE; 265 cbData.callBackOption = COMPARE;
246 cbData.cfgDiffs = cfgDiffs; 266 cbData.cfgDiffs = cfgDiffs;
247 GNUNET_CONFIGURATION_iterate (cfg, diffsCallBack, &cbData); 267 GNUNET_CONFIGURATION_iterate (cfg,
268 &diffsCallBack,
269 &cbData);
248 if (1 == (ret = cbData.status)) 270 if (1 == (ret = cbData.status))
249 { 271 {
250 fprintf (stderr, "%s", 272 fprintf (stderr, "%s",