+ rctx_start();
+ XBT_VERB("[%s] More than one command in this chunk of lines", filepos);
+ }
+ if (kind == '&')
+ rctx->is_background = 1;
+ else
+ rctx->is_background = 0;
+
+ rctx->cmd = xbt_strdup(line);
+ rctx->filepos = xbt_strdup(filepos);
+ if (option){
+ char *newcmd = bprintf("%s %s", rctx->cmd, option);
+ free(rctx->cmd);
+ rctx->cmd = newcmd;
+ }
+ XBT_INFO("[%s] %s%s", filepos, rctx->cmd,
+ ((rctx->is_background) ? " (background command)" : ""));
+
+ break;
+
+ case '<':
+ rctx->is_empty = 0;
+ xbt_strbuff_append(rctx->input, line);
+ xbt_strbuff_append(rctx->input, "\n");
+ break;
+
+ case '>':
+ rctx->is_empty = 0;
+ xbt_strbuff_append(rctx->output_wanted, line);
+ xbt_strbuff_append(rctx->output_wanted, "\n");
+ XBT_DEBUG("wanted:%s",rctx->output_wanted->data);
+ break;
+
+ case '!':
+ if (rctx->cmd)
+ rctx_start();
+
+ if (!strncmp(line, "timeout no", strlen("timeout no"))) {
+ XBT_VERB("[%s] (disable timeout)", filepos);
+ timeout_value = -1;
+ } else if (!strncmp(line, "timeout ", strlen("timeout "))) {
+ timeout_value = atoi(line + strlen("timeout"));
+ XBT_VERB("[%s] (new timeout value: %d)", filepos, timeout_value);
+
+ } else if (!strncmp(line, "expect signal ", strlen("expect signal "))) {
+ rctx->expected_signal = strdup(line + strlen("expect signal "));
+ xbt_str_trim(rctx->expected_signal, " \n");
+ XBT_VERB("[%s] (next command must raise signal %s)",
+ filepos, rctx->expected_signal);
+
+ } else if (!strncmp(line, "expect return ", strlen("expect return "))) {
+ rctx->expected_return = atoi(line + strlen("expect return "));
+ XBT_VERB("[%s] (next command must return code %d)",
+ filepos, rctx->expected_return);
+
+ } else if (!strncmp(line, "output sort", strlen("output sort"))) {
+ sort_len = atoi(line + strlen("output sort"));
+ if (sort_len==0)
+ sort_len=SORT_LEN_DEFAULT;
+ rctx->output_sort = 1;
+ XBT_VERB("[%s] (sort output of next command)", filepos);
+
+ } else if (!strncmp(line, "output ignore", strlen("output ignore"))) {
+ rctx->output = e_output_ignore;
+ XBT_VERB("[%s] (ignore output of next command)", filepos);
+
+ } else if (!strncmp(line, "output display", strlen("output display"))) {
+ rctx->output = e_output_display;
+ XBT_VERB("[%s] (ignore output of next command)", filepos);
+
+ } else if (!strncmp(line, "setenv ", strlen("setenv "))) {
+ int len = strlen("setenv ");
+ char *eq = strchr(line + len, '=');
+ char *key = bprintf("%.*s", (int) (eq - line - len), line + len);
+ xbt_dict_set(env, key, xbt_strdup(eq + 1), NULL);
+ free(key);
+
+ rctx->env = realloc(rctx->env, ++(rctx->env_size) * sizeof(char *));
+ rctx->env[rctx->env_size - 2] = xbt_strdup(line + len);
+ rctx->env[rctx->env_size - 1] = NULL;
+ XBT_VERB("[%s] setenv %s", filepos, line + len);
+
+ } else {
+ XBT_ERROR("%s: Malformed metacommand: %s", filepos, line);
+ XBT_ERROR("Test suite `%s': NOK (syntax error)", testsuite_name);
+ rctx_armageddon(rctx, 1);
+ return;
+ }
+ break;