- case '$':
- case '&':
- if (rctx->cmd) {
- if (!rctx->is_empty) {
- ERROR2("[%s] More than one command in this chunk of lines (previous: %s).\n"
- " Dunno which input/output belongs to which command.",
- filepos,rctx->cmd);
- ERROR1("Test suite `%s': NOK (syntax error)",testsuite_name);
- rctx_armageddon(rctx,1);
- return;
- }
- rctx_start();
- VERB1("[%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);
- INFO3("[%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");
- break;
-
- case '!':
- if (rctx->cmd)
- rctx_start();
-
- if (!strncmp(line,"timeout no",strlen("timeout no"))) {
- VERB1("[%s] (disable timeout)", filepos);
- timeout_value = -1;
- } else if (!strncmp(line,"timeout ",strlen("timeout "))) {
- timeout_value=atoi(line+strlen("timeout"));
- VERB2("[%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");
- VERB2("[%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 "));
- VERB2("[%s] (next command must return code %d)",
- filepos, rctx->expected_return);
-
- } else if (!strncmp(line,"output ignore",strlen("output ignore"))) {
- rctx->output = e_output_ignore;
- VERB1("[%s] (ignore output of next command)", filepos);
-
- } else if (!strncmp(line,"output display",strlen("output display"))) {
- rctx->output = e_output_display;
- VERB1("[%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),xbt_free_f);
-
- 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;
- VERB2("[%s] setenv %s", filepos,line+len);
-
-// } else if (!strncmp(line,"file ",strlen("file "))) {
-
- } else {
- ERROR2("%s: Malformed metacommand: %s",filepos,line);
- ERROR1("Test suite `%s': NOK (syntax error)",testsuite_name);
- rctx_armageddon(rctx,1);