From 0d24e380ff394782358da99b776a187d402142e9 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Fri, 27 Nov 2015 14:21:01 +0000 Subject: Convert last cmdtests to yarns The conversion was made so that the build command was used instead of the build-morphology command. Change-Id: I67c43d765ed603ecdd806bc649815526243b7b87 --- scripts/test-shell.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/test-shell.c b/scripts/test-shell.c index 963d128c..a57fddce 100644 --- a/scripts/test-shell.c +++ b/scripts/test-shell.c @@ -163,6 +163,9 @@ int run_commands(FILE *cmdstream){ ret = 1; break; } + } else if (strstr(line, "printvar ") == line) { + char const *var = line + sizeof("printvar ") - 1; + fprintf(stdout, "%s\n", getenv(var)); } else if (strstr(line, "create file ") == line) { char const *filename = line + sizeof("create file ") -1; FILE *outfile = fopen(filename, "w"); @@ -178,6 +181,12 @@ int run_commands(FILE *cmdstream){ break; } fclose(outfile); + } else if (strstr(line, "file exists ") == line) { + char const *filename = line + sizeof("file exists ") -1; + fprintf(stderr, "FILENAME: %s\n", filename); + struct stat st; + int result = stat(filename, &st); + return result != 0; } else if (line[0] == '#' || strstr(line, "set ") == line) { /* Comments and set commands are ignored */ continue; @@ -201,7 +210,8 @@ int main(int argc, char *argv[]) { FILE *cmdstream = fopen(argv[1], "r"); return run_commands(cmdstream); } else { - fprintf(stderr, "Usage: %s -c COMMAND|%s SCRIPT\n", argv[0], argv[0]); + fprintf(stderr, "Usage: %s -x -c COMMAND|%s SCRIPT\n", + argv[0], argv[0]); return 1; } } -- cgit v1.2.1