tranche-target runs
authorThomas Walker Lynch <thomas.lynch@reasoningtechnology.com>
Fri, 29 Mar 2019 00:29:38 +0000 (01:29 +0100)
committerThomas Walker Lynch <thomas.lynch@reasoningtechnology.com>
Fri, 29 Mar 2019 00:29:38 +0000 (01:29 +0100)
32 files changed:
module/da/test/lib/test.dat [new file with mode: 0644]
module/da/test/makefile
module/da/test/makefile-dep [deleted file]
module/da/test/makefile-flags
module/da/test/src/test_da.cli.c [new file with mode: 0644]
module/da/test/src/test_da.lib.c [new file with mode: 0644]
module/da/test/src/test_da.lib.h [new file with mode: 0644]
module/da/test/test.dat [deleted file]
module/da/test/test_da.cli.c [deleted file]
module/da/test/test_da.cli.o [deleted file]
module/da/test/test_da.lib.c [deleted file]
module/da/test/test_da.lib.h [deleted file]
module/da/test/test_da.lib.o [deleted file]
module/share/bin/tranche [new file with mode: 0755]
module/share/bin/tranche-target [new file with mode: 0755]
module/share/include/tranche.h
module/share/lib/libda.a
module/share/lib/libtranche.a [new file with mode: 0644]
module/tranche/src/tranche-target.cli.c [new file with mode: 0644]
module/tranche/src/tranche-targets.cli.c [deleted file]
module/tranche/src/tranche.lib.c
module/tranche/src/tranche.lib.h
module/tranche/test/test2.sh [new file with mode: 0644]
module/tranche/test/test2stdout.dat [new file with mode: 0644]
module/tranche/test/test2stdout.dat.expected [new file with mode: 0644]
module/tranche/test/test3.out.expected [new file with mode: 0644]
module/tranche/test/test3.sh [new file with mode: 0644]
module/tranche/test/test4.out [new file with mode: 0644]
module/tranche/test/test4.sh [new file with mode: 0644]
module/tranche/test/tranche
module/tranche/test/tranche-target [new symlink]
tool/lib/makefile_cc

diff --git a/module/da/test/lib/test.dat b/module/da/test/lib/test.dat
new file mode 100644 (file)
index 0000000..6b4b5bd
--- /dev/null
@@ -0,0 +1,3 @@
+this is a test
+ends without a newline
+(setq mode-require-final-newline nil)
\ No newline at end of file
index dbd6be0..ae31fa3 100644 (file)
@@ -7,6 +7,14 @@ SHELL=/bin/bash
 .PHONY: all
 all: version deps lib exec
 
+.PHONY: lib
+lib:
+       $(MAKE) $@
+
+.PHONY: exec
+exec:
+       $(MAKE) $@
+
 %::
        $(MAKE) $@
 
diff --git a/module/da/test/makefile-dep b/module/da/test/makefile-dep
deleted file mode 100644 (file)
index cf61fb9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-./test_da.lib.o: test_da.lib.c ../include/da.h test_da.lib.h
-./test_da.cli.o: test_da.cli.c test_da.lib.h
-
-./test_da : ./test_da.cli.o ./libtest.a
-       gcc -o ./test_da ./test_da.cli.o -L. -L../lib -ltest -lda
index a8adf4d..dbcffea 100644 (file)
@@ -7,27 +7,13 @@ ECHO= echo
 
 # directories used by this makefile, these could all be set to dot for
 # the simplest source directory structure
-
-#LIDBIR, EXECSDIR, HDIR hold the make results that might later be shared
-#$(PWD) is the directory that make was called from, this is already build in
-#set to dot to use the same directory as the source code
-#leave blank to ommit
-DEPRDIR=
-DOCDIR=
-EXECDIR=.
-INCDIR=.
-LIBDIR=.
-SRCDIR=.
 TESTDIR=
-TMPDIR=.
-TOOLDIR=$(realpath $(PROJECT_SUBU)/tool)
-TRYDIR=
 
 # compiler and flags
 C=gcc
 CFLAGS=-std=gnu11 -fPIC -I../include -ggdb -Werror -DDEBUG -DDEBUGDB 
 #CFLAGS=-std=gnu11 -fPIC -I../include -Werror
-LINKFLAGS=-L. -L../lib -ltest -lda
+LINKFLAGS= -Llib -L../lib -ltest -lda
 
 MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile_cc
 #MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tool/lib/makefile_cc
diff --git a/module/da/test/src/test_da.cli.c b/module/da/test/src/test_da.cli.c
new file mode 100644 (file)
index 0000000..bee5a6c
--- /dev/null
@@ -0,0 +1,46 @@
+
+#include <stdio.h>
+#include <stdbool.h>
+#include "test_da.lib.h"
+
+int main(){
+  bool da_0_passed = test_da_0();
+
+  unsigned int passed = 0;
+  unsigned int failed = 0;
+
+  // enumeration of tests
+  typedef bool (*test_fun)();
+  test_fun tests[] = {test_da_0, test_da_1, test_da_2, test_da_3, NULL};
+  char *test_names[] = {"test_da_0", "test_da_1", "test_da_2", "test_da_3", NULL};
+
+  // call tests
+  test_fun *tfp = tests;
+  char **tnp = test_names;
+  while(*tfp){
+    if( !(*tfp)() ){
+      failed++;
+      if(*tnp)
+        printf("%s failed\n", *tnp);
+      else
+        fprintf(stderr, "internal error, no test_names[] entry for test\n");
+    }else
+      passed++;
+  tfp++;
+  tnp++;
+  }
+
+  // summarize results
+
+  if( passed == 0 && failed == 0)
+    printf("no tests ran\n");
+  else if( passed == 0 )
+    printf("failed all %u tests\n", failed);
+  else if( failed == 0 )
+    printf("passed all %u tests\n", passed);
+  else
+    printf("failed %u of %u tests\n", failed, passed + failed);
+
+  if( passed == 0 || failed != 0 ) return 1;
+  return 0;
+}
diff --git a/module/da/test/src/test_da.lib.c b/module/da/test/src/test_da.lib.c
new file mode 100644 (file)
index 0000000..0ab06c8
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+Tests for Da.
+
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <da.h>
+
+#include "test_da.lib.h"
+
+// tests push
+bool test_da_0(){
+  Da da;
+  da_alloc(&da, sizeof(int)); // leaves room for 4 ints
+  int i = 0;
+  int *pt = (int *)da.base;
+  // will double, 4 -> 8, then double 8 -> 16
+  while( i < 10 ){
+    da_push(&da, &i);
+  i++;
+  pt++;
+  }
+
+  bool f0 = da.size == sizeof(int) * 16;
+  bool f1 = 10 == (da.end - da.base) / sizeof(int);
+  bool f2 = true;
+  pt = (int *)da.base;
+  i = 0;
+  while( i < 10 ){
+    f2 = f2 && *pt == i && !da_endq(&da, pt);
+  i++;
+  pt++;
+  }
+  bool f3 = da_endq(&da, pt);
+
+  return f0 && f1 && f2 && f3;
+}
+
+// tests manual expansion
+bool test_da_1(){
+  Da da;
+  da_alloc(&da, sizeof(int)); // leaves room for 4 ints
+  int i = 0;
+  int *pt = (int *)da.base;
+  // will double, 4 -> 8, then double 8 -> 16
+  while( i < 10 ){
+    da.end += da.element_size;
+    if( da_boundq(&da) ){
+      char *old_base = da_expand(&da);
+      da_rebase(&da, old_base, &pt);
+    }
+    *pt = i;
+  i++;
+  pt++;
+  }
+
+  bool f0 = da.size == sizeof(int) * 16;
+  bool f1 = 10 == (da.end - da.base) / sizeof(int);
+  bool f2 = true;
+  pt = (int *)da.base;
+  i = 0;
+  while( i < 10 ){
+    f2 = f2 && *pt == i && !da_endq(&da, pt);
+  i++;
+  pt++;
+  }
+  bool f3 = da_endq(&da, pt);
+
+  return f0 && f1 && f2 && f3;
+}
+
+// da_fgets
+bool test_da_2(){
+
+  char *data_file_name = "../lib/test.dat";
+  FILE *file = fopen(data_file_name,"r");
+  if(!file){
+    fprintf(stderr,"test_da_2, could not open data file %s for reading\n", data_file_name);
+    return false;
+  }
+
+  Da da;
+  da_alloc(&da, sizeof(char));
+
+  da_fgets(&da, file);
+  bool f0 = !strcmp(da.base, "this is a test");
+
+  char *old_base;
+  da_pop(&da, NULL); // pop the prior null terminator
+  char *s1 = da.end;
+  old_base = da_fgets(&da,file);
+  da_rebase(&da, old_base, &s1);
+  bool f1 = !strcmp(s1, "ends without a newline");
+  
+  da_pop(&da, NULL); // pop the prior null terminator
+  char *s2 = da.end;
+  old_base = da_fgets(&da,file);
+  da_rebase(&da, old_base, &s2);
+  bool f2 = !strcmp(s2, "(setq mode-require-final-newline nil)");
+
+  bool f3 = !strcmp(da.base, "this is a testends without a newline(setq mode-require-final-newline nil)");
+
+  fclose(file);
+  return f0 && f1 && f2 && f3;
+}
+
+// da_fgets
+bool test_da_3(){
+
+  Da da;
+  da_alloc(&da, sizeof(int));
+
+  int i = 5;
+  da_push(&da, &i);
+  i++;
+  da_push(&da, &i);
+  i++;
+  da_push(&da, &i);
+
+  int j;
+  bool f0 = da_pop(&da, &j) && j == 7;
+  bool f1 = da_pop(&da, &j) && j == 6;
+  bool f2 = da_pop(&da, NULL);
+  bool f3 = !da_pop(&da, &j);
+
+  return f0 && f1 && f2 && f3;
+}
+
+
+
+
diff --git a/module/da/test/src/test_da.lib.h b/module/da/test/src/test_da.lib.h
new file mode 100644 (file)
index 0000000..686b0d0
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef DA_LIB_H
+#define DA_LIB_H
+
+bool test_da_0();
+bool test_da_1();
+bool test_da_2();
+bool test_da_3();
+
+#endif
diff --git a/module/da/test/test.dat b/module/da/test/test.dat
deleted file mode 100644 (file)
index 6b4b5bd..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-this is a test
-ends without a newline
-(setq mode-require-final-newline nil)
\ No newline at end of file
diff --git a/module/da/test/test_da.cli.c b/module/da/test/test_da.cli.c
deleted file mode 100644 (file)
index bee5a6c..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-
-#include <stdio.h>
-#include <stdbool.h>
-#include "test_da.lib.h"
-
-int main(){
-  bool da_0_passed = test_da_0();
-
-  unsigned int passed = 0;
-  unsigned int failed = 0;
-
-  // enumeration of tests
-  typedef bool (*test_fun)();
-  test_fun tests[] = {test_da_0, test_da_1, test_da_2, test_da_3, NULL};
-  char *test_names[] = {"test_da_0", "test_da_1", "test_da_2", "test_da_3", NULL};
-
-  // call tests
-  test_fun *tfp = tests;
-  char **tnp = test_names;
-  while(*tfp){
-    if( !(*tfp)() ){
-      failed++;
-      if(*tnp)
-        printf("%s failed\n", *tnp);
-      else
-        fprintf(stderr, "internal error, no test_names[] entry for test\n");
-    }else
-      passed++;
-  tfp++;
-  tnp++;
-  }
-
-  // summarize results
-
-  if( passed == 0 && failed == 0)
-    printf("no tests ran\n");
-  else if( passed == 0 )
-    printf("failed all %u tests\n", failed);
-  else if( failed == 0 )
-    printf("passed all %u tests\n", passed);
-  else
-    printf("failed %u of %u tests\n", failed, passed + failed);
-
-  if( passed == 0 || failed != 0 ) return 1;
-  return 0;
-}
diff --git a/module/da/test/test_da.cli.o b/module/da/test/test_da.cli.o
deleted file mode 100644 (file)
index d28221c..0000000
Binary files a/module/da/test/test_da.cli.o and /dev/null differ
diff --git a/module/da/test/test_da.lib.c b/module/da/test/test_da.lib.c
deleted file mode 100644 (file)
index 88a94c7..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Tests for Da.
-
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdbool.h>
-#include <da.h>
-
-#include "test_da.lib.h"
-
-// tests push
-bool test_da_0(){
-  Da da;
-  da_alloc(&da, sizeof(int)); // leaves room for 4 ints
-  int i = 0;
-  int *pt = (int *)da.base;
-  // will double, 4 -> 8, then double 8 -> 16
-  while( i < 10 ){
-    da_push(&da, &i);
-  i++;
-  pt++;
-  }
-
-  bool f0 = da.size == sizeof(int) * 16;
-  bool f1 = 10 == (da.end - da.base) / sizeof(int);
-  bool f2 = true;
-  pt = (int *)da.base;
-  i = 0;
-  while( i < 10 ){
-    f2 = f2 && *pt == i && !da_endq(&da, pt);
-  i++;
-  pt++;
-  }
-  bool f3 = da_endq(&da, pt);
-
-  return f0 && f1 && f2 && f3;
-}
-
-// tests manual expansion
-bool test_da_1(){
-  Da da;
-  da_alloc(&da, sizeof(int)); // leaves room for 4 ints
-  int i = 0;
-  int *pt = (int *)da.base;
-  // will double, 4 -> 8, then double 8 -> 16
-  while( i < 10 ){
-    da.end += da.element_size;
-    if( da_boundq(&da) ){
-      char *old_base = da_expand(&da);
-      da_rebase(&da, old_base, &pt);
-    }
-    *pt = i;
-  i++;
-  pt++;
-  }
-
-  bool f0 = da.size == sizeof(int) * 16;
-  bool f1 = 10 == (da.end - da.base) / sizeof(int);
-  bool f2 = true;
-  pt = (int *)da.base;
-  i = 0;
-  while( i < 10 ){
-    f2 = f2 && *pt == i && !da_endq(&da, pt);
-  i++;
-  pt++;
-  }
-  bool f3 = da_endq(&da, pt);
-
-  return f0 && f1 && f2 && f3;
-}
-
-// da_fgets
-bool test_da_2(){
-
-  FILE *fd = fopen("test.dat","r");
-
-  Da da;
-  da_alloc(&da, sizeof(char));
-
-  da_fgets(&da, fd);
-  bool f0 = !strcmp(da.base, "this is a test");
-
-  char *old_base;
-  da_pop(&da, NULL); // pop the prior null terminator
-  char *s1 = da.end;
-  old_base = da_fgets(&da,fd);
-  da_rebase(&da, old_base, &s1);
-  bool f1 = !strcmp(s1, "ends without a newline");
-  
-  da_pop(&da, NULL); // pop the prior null terminator
-  char *s2 = da.end;
-  old_base = da_fgets(&da,fd);
-  da_rebase(&da, old_base, &s2);
-  bool f2 = !strcmp(s2, "(setq mode-require-final-newline nil)");
-
-  bool f3 = !strcmp(da.base, "this is a testends without a newline(setq mode-require-final-newline nil)");
-
-  fclose(fd);
-  return f0 && f1 && f2 && f3;
-}
-
-// da_fgets
-bool test_da_3(){
-
-  FILE *fd = fopen("test.dat","r");
-
-  Da da;
-  da_alloc(&da, sizeof(int));
-
-  int i = 5;
-  da_push(&da, &i);
-  i++;
-  da_push(&da, &i);
-  i++;
-  da_push(&da, &i);
-
-  int j;
-  bool f0 = da_pop(&da, &j) && j == 7;
-  bool f1 = da_pop(&da, &j) && j == 6;
-  bool f2 = da_pop(&da, NULL);
-  bool f3 = !da_pop(&da, &j);
-
-  return f0 && f1 && f2 && f3;
-}
-
-
-
-
diff --git a/module/da/test/test_da.lib.h b/module/da/test/test_da.lib.h
deleted file mode 100644 (file)
index 686b0d0..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef DA_LIB_H
-#define DA_LIB_H
-
-bool test_da_0();
-bool test_da_1();
-bool test_da_2();
-bool test_da_3();
-
-#endif
diff --git a/module/da/test/test_da.lib.o b/module/da/test/test_da.lib.o
deleted file mode 100644 (file)
index 2a03683..0000000
Binary files a/module/da/test/test_da.lib.o and /dev/null differ
diff --git a/module/share/bin/tranche b/module/share/bin/tranche
new file mode 100755 (executable)
index 0000000..bd19f79
Binary files /dev/null and b/module/share/bin/tranche differ
diff --git a/module/share/bin/tranche-target b/module/share/bin/tranche-target
new file mode 100755 (executable)
index 0000000..bc5d9c1
Binary files /dev/null and b/module/share/bin/tranche-target differ
index 27990a6..4c1d2f3 100644 (file)
@@ -1,8 +1,12 @@
 #ifndef TRANCHE_LIB_H
 #define TRANCHE_LIB_H
 
-int tranche_send(FILE *src, Da *arg_fds);
+#define TRANCHE_ERR_ARGC 1
+#define TRANCHE_ERR_SRC_OPEN 2
+#define TRANCHE_ERR_DEP_OPEN 4
 
+int tranche_send(FILE *src, Da *arg_fds);
+int tranche_target(FILE *src, Da *targets);
 
 
 #endif
index f414c16..a7b5b79 100644 (file)
Binary files a/module/share/lib/libda.a and b/module/share/lib/libda.a differ
diff --git a/module/share/lib/libtranche.a b/module/share/lib/libtranche.a
new file mode 100644 (file)
index 0000000..3e540aa
Binary files /dev/null and b/module/share/lib/libtranche.a differ
diff --git a/module/tranche/src/tranche-target.cli.c b/module/tranche/src/tranche-target.cli.c
new file mode 100644 (file)
index 0000000..b579e88
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+Scans a tranche and lists the named target files.
+
+stdout is not explicitly named.  Would be intersting if stdout
+were also listed if anything is sent to stdout. Might distinguish
+between blank lines being sent and text being sent to stdout.
+
+*/
+  
+#include <stdio.h>
+#include <unistd.h>
+#include <da.h>
+#include "tranche.lib.h"
+
+#define ERR_ARGC 1
+#define ERR_SRC_OPEN 2
+
+
+int main(int argc, char **argv, char **envp){
+  if(argc != 2){
+    fprintf(stderr, "usage: %s <source>\n",argv[0]);
+    return ERR_ARGC;
+  }
+  char *src_file_name = argv[1];
+
+  int dep_fd;
+  FILE *src_file = fopen(src_file_name, "r");
+  unsigned int err = 0;
+  if(!src_file){
+    fprintf(stderr,"could not open tranche source file %s\n", src_file_name);
+    err+= ERR_SRC_OPEN;
+  }
+  if(err) return err;
+
+  Da target_arr;
+  Da *target_arrp = &target_arr;
+  da_alloc(target_arrp, sizeof(char *));
+  tranche_target(src_file, target_arrp);
+  da_strings_puts(target_arrp);
+  da_free_elements(target_arrp);
+  fclose(src_file);
+  return 0;
+}
diff --git a/module/tranche/src/tranche-targets.cli.c b/module/tranche/src/tranche-targets.cli.c
deleted file mode 100644 (file)
index 0ad2045..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-Scans a tranche and lists the named target files.
-
-stdout is not explicitly named.  Would be intersting if stdout
-were also listed if anything is sent to stdout. Might distinguish
-between blank lines being sent and text being sent to stdout.
-
-*/
-  
-#include <stdio.h>
-#include <unistd.h>
-#include <da.h>
-#include "tranche.lib.h"
-
-#define ERR_ARGC 1
-#define ERR_SRC_OPEN 2
-
-
-int main(int argc, char **argv, char **envp){
-  if(argc != 2){
-    fprintf(stderr, "usage: %s <source>\n",argv[0]);
-    return ERR_ARGC;
-  }
-  char *src_file_name = argv[1];
-
-  int dep_fd;
-  FILE *src_file = fopen(src_file_name, "r");
-  unsigned int err = 0;
-  if(!src_file){
-    fprintf(stderr,"could not open tranche source file %s\n", src_file_name);
-    err+= ERR_SRC_OPEN;
-  }
-  if(err) return err;
-
-  Da targets;
-  da_alloc(&targets, sizeof(char *));
-  tranche_targets(src_file, &targets);
-  da_strings_puts(&targets);
-  fclose(src_file);
-  return 0;
-}
index 533fa11..276fa95 100644 (file)
@@ -132,39 +132,38 @@ static void string_equal(void *sp, void *closure){
   char *string_element = *(char **)sp;
   string_state *ss = (string_state *)closure;
   if( ss->found ) return;
-  char *test_string = ss->string;
-  ss->found = !strcmp(string_element, test_string);
+  ss->found = !strcmp(string_element, ss->string);
   return;
 }
-static bool exists(Da *strings, char *test_string){
+static bool exists(Da *string_arrp, char *test_string){
   string_state ss;
   ss.string = test_string;
   ss.found = false;
-  da_map(strings, string_equal, &ss);
+  da_map(string_arrp, string_equal, &ss);
   return ss.found;
 }
 
 // only inserts the string if it is not already in the array
-static void insert_if_unique(Da *strings, char *proffered_string){
-  if( exists( strings, proffered_string)){ // then throw it away, we don't need it
+static void insert_if_unique(Da *string_arrp, char *proffered_string){
+  if( exists( string_arrp, proffered_string)){ // then throw it away, we don't need it
     free(proffered_string);
     return;
   }
-  da_push(strings, proffered_string);
+  da_push(string_arrp, &proffered_string);
 }
 
 // dissolves proffered array into the existing array
 static void combine_one(void *psp, void *closure){
-  char *proffered_string = (char *)psp;
-  Da *strings = (Da *)closure;
-  insert_if_unique(strings, proffered_string);
+  char *proffered_string = *(char **)psp;
+  Da *string_arrp = (Da *)closure;
+  insert_if_unique(string_arrp, proffered_string);
 }
-static void combine(Da *strings, Da *proffered_strings){
-  da_map(proffered_strings, combine_one, strings);
+static void combine(Da *string_arrp, Da *proffered_string_arrp){
+  da_map(proffered_string_arrp, combine_one, string_arrp);
   return;
 }
 
-int tranche_targets(FILE *src, Da *targets){
+int tranche_target(FILE *src, Da *target_arrp){
   char *pt;
   Da line; // buffer holding the characters from a line
   Da file_name_arr;// an array of file name parameters parsed from a #tranche line
@@ -176,7 +175,9 @@ int tranche_targets(FILE *src, Da *targets){
     pt = is_tranche_begin(line.base);
     if(pt){ // then this line is the start of a nested tranche block
       parse_file_list(&file_name_arr, pt);
-      combine(targets, &file_name_arr); // frees strings that are not inserted
+      combine(target_arrp, &file_name_arr); // frees strings that are not inserted
+      da_rewind(&file_name_arr);
+      tranche_target(src, target_arrp);
     }
     da_rewind(&line);
   }
index 3873b67..4c1d2f3 100644 (file)
@@ -6,7 +6,7 @@
 #define TRANCHE_ERR_DEP_OPEN 4
 
 int tranche_send(FILE *src, Da *arg_fds);
-int tranche_targets(FILE *src, Da *targets);
+int tranche_target(FILE *src, Da *targets);
 
 
 #endif
diff --git a/module/tranche/test/test2.sh b/module/tranche/test/test2.sh
new file mode 100644 (file)
index 0000000..1a4cf28
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash -x
+./tranche test2.trc.c >test2stdout.dat
+diff test2.c test2.c.expected
+diff test2.h test2.h.expected
+diff test2stdout.dat test2stdout.dat.expected
+rm test2.c test2.h
+
+
diff --git a/module/tranche/test/test2stdout.dat b/module/tranche/test/test2stdout.dat
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
diff --git a/module/tranche/test/test2stdout.dat.expected b/module/tranche/test/test2stdout.dat.expected
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
diff --git a/module/tranche/test/test3.out.expected b/module/tranche/test/test3.out.expected
new file mode 100644 (file)
index 0000000..8294b86
--- /dev/null
@@ -0,0 +1,5 @@
+test11.dat
+test12.dat
+test13.dat
+test14.dat
+test15.dat
diff --git a/module/tranche/test/test3.sh b/module/tranche/test/test3.sh
new file mode 100644 (file)
index 0000000..e655682
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash -x
+./tranche-target test1.dat > test3.out
+diff test3.out test3.out.expected
+rm test3.out
+
+
diff --git a/module/tranche/test/test4.out b/module/tranche/test/test4.out
new file mode 100644 (file)
index 0000000..05de4b1
--- /dev/null
@@ -0,0 +1,2 @@
+test2.c
+test2.h
diff --git a/module/tranche/test/test4.sh b/module/tranche/test/test4.sh
new file mode 100644 (file)
index 0000000..49c7c4b
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash -x
+./tranche-target test2.trc.c > test4.out
+diff test4.out test4.out.expected
+rm test4.out
+
+
index acf4a6f..701f193 120000 (symlink)
@@ -1 +1 @@
-../1_execs/tranche
\ No newline at end of file
+../exec/tranche
\ No newline at end of file
diff --git a/module/tranche/test/tranche-target b/module/tranche/test/tranche-target
new file mode 120000 (symlink)
index 0000000..51e3cfa
--- /dev/null
@@ -0,0 +1 @@
+../exec/tranche-target
\ No newline at end of file
index d9694e8..1fc00e6 100755 (executable)
@@ -42,10 +42,6 @@ TMPDIR=tmp
 TOOLDIR=$(realpath $(PROJECT_SUBU)/tool)
 TRYDIR=try
 
-DEPFILE=$(TMPDIR)/makefile-dep
-LIBFILE=$(LIBDIR)/lib$(MODULE).a
-INCFILE=$(INCDIR)/$(MODULE).h
-
 # a single space literal, for example if you wanted to subsitute commas to
 # spaces: $(subst $(space),;,$(string))
 blank :=
@@ -61,6 +57,10 @@ CC=
 
 -include makefile-flags
 
+DEPFILE=$(TMPDIR)/makefile-dep
+LIBFILE=$(LIBDIR)/lib$(MODULE).a
+INCFILE=$(INCDIR)/$(MODULE).h
+
 #--------------------------------------------------------------------------------
 # targets
 
@@ -166,9 +166,9 @@ sub_exec: $(EXEC)
 
 .PHONY: share
 share:
-       if [ -f $(LIBFILE) ];then cp $(LIBFILE) $(SHAREDIR)/lib; fi
-       if [ -f $(INCFILE) ];then cp $(INCFILE) $(SHAREDIR)/include; fi
-       if [ $(shell ls -A $(EXECDIR)) ];then cp $(EXECDIR)/* $(SHAREDIR)/bin; fi
+       if [ ! -z "$(wildcard $(LIBDIR)/*)" ]; then cp $(LIBDIR)/* $(SHAREDIR)/lib; fi
+       if [ ! -z "$(wildcard $(INCDIR)/*)" ]; then cp $(INCDIR)/* $(SHAREDIR)/include; fi
+       if [ ! -z "$(wildcard $(EXECDIR)/*)" ]; then cp $(EXECDIR)/* $(SHAREDIR)/bin; fi
 
 .PHONY: clean
 clean: