[PATCH] XCore target: add support to build MultiSource/Applications/lemon

robert lytton robert at xmos.com
Thu Feb 13 11:49:10 PST 2014


xcore does not support fork()
Move where the test runs itself multiple times from the binary into the RUNUNDER script.

http://llvm-reviews.chandlerc.com/D2784

Files:
  MultiSource/Applications/lemon/Makefile
  MultiSource/Applications/lemon/lemon.c

Index: MultiSource/Applications/lemon/Makefile
===================================================================
--- MultiSource/Applications/lemon/Makefile
+++ MultiSource/Applications/lemon/Makefile
@@ -6,6 +6,13 @@
 RUN_OPTIONS = $(PROJ_SRC_DIR)/parse.y $(PROJ_SRC_DIR)/example1.y $(PROJ_SRC_DIR)/example2.y $(PROJ_SRC_DIR)/example3.y $(PROJ_SRC_DIR)/example4.y $(PROJ_SRC_DIR)/example5.y $(PROJ_SRC_DIR)/lighttpd_configparser.y $(PROJ_SRC_DIR)/lighttpd_mod_ssi_exprparser.y $(PROJ_SRC_DIR)/wireshark_dtd_grammar.lemon $(PROJ_SRC_DIR)/wireshark_grammar.lemon $(PROJ_SRC_DIR)/wireshark_mate_grammar.lemon $(PROJ_SRC_DIR)/xapian_queryparser.lemony $(PROJ_SRC_DIR)/ecmascript.y
 HASH_PROGRAM_OUTPUT = 1
 
+ifeq ($(ARCH),XCore)
+# XCore must run multiple tests from a script rather than use fork().
+# This test needs to be repeated 20 times.
+RUN_OPTIONS = $(RUN_OPTIONS) $(RUN_OPTIONS) $(RUN_OPTIONS) $(RUN_OPTIONS) $(RUN_OPTIONS)
+RUN_OPTIONS = XCORE_FORK $(RUN_OPTIONS) $(RUN_OPTIONS) $(RUN_OPTIONS) $(RUN_OPTIONS)
+endif
+
 # With a Debug+Asserts build may time out if the default limit is used.
 RUNTIMELIMIT := 1500
 
Index: MultiSource/Applications/lemon/lemon.c
===================================================================
--- MultiSource/Applications/lemon/lemon.c
+++ MultiSource/Applications/lemon/lemon.c
@@ -1515,7 +1515,9 @@
     printf("                   %d states, %d parser table entries, %d conflicts\n",
       lem.nstate, lem.tablesize, lem.nconflict);
   }
+#ifndef __XS1B__
   exit(lem.errorcnt + lem.nconflict);
+#endif
   return (lem.errorcnt + lem.nconflict);
 }
 /******************** From the file "msort.c" *******************************/
@@ -4857,6 +4859,15 @@
  * one input a time, and has a global state */
 int main(int argc, char **argv)
 {
+#ifdef __XS1B__
+	if (argc == 2) {
+		/* we pass in one child at a time from the wrapper script */
+		char *argv_child[] = {"lemon-child","-s",argv[1],NULL};
+		fprintf(stdout,"Processing %s\n",mybasename(argv[1]));
+		if (lemon_main(3, argv_child))
+			fprintf(stderr,"Error while running on: %s\n",mybasename(argv[1]));
+	}
+#else
 	int j,i = 0;
 	for(j=0;j<20;j++) {
 		/* test finishes too fast, run more times to get
@@ -4877,6 +4888,7 @@
 			}
 		}
 	}
+#endif
 	return 0;
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2784.1.patch
Type: text/x-patch
Size: 2270 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140213/497d3a31/attachment.bin>


More information about the llvm-commits mailing list