fix `make check' for build in a separate directory

This commit is contained in:
rlar 2011-01-25 18:39:06 +00:00
parent c349a97ea1
commit f40f6c705a
15 changed files with 73 additions and 9 deletions

View File

@ -1,3 +1,20 @@
2011-01-25 Robert Larice
* Modified src/include/cmproto.h ,
* Modified src/xspice/icm/dlmain.c ,
* Modified src/xspice/icm/digital/d_source/cfunc.mod ,
* Modified src/xspice/icm/digital/d_state/cfunc.mod ,
* Modified tests/bin/check.sh ,
* Added tests/bin/spinit ,
* Modified tests/bsim3/dc_sim/Makefile.am ,
* Modified tests/bsim3soi/Makefile.am ,
* Modified tests/bsim3soidd/Makefile.am ,
* Modified tests/bsim3soifd/Makefile.am ,
* Modified tests/bsim3soipd/Makefile.am ,
* Modified tests/bsim4/Makefile.am ,
* Modified tests/xspice/digital/Makefile.am ,
* Modified tests/xspice/digital/spinit.in :
fix `make check' for build in a separate directory
2011-01-25 Robert Larice
* Modified configure.ac ,
* Modified src/xspice/Makefile.am ,

View File

@ -102,4 +102,6 @@ void *calloc_pj(size_t s1, size_t s2);
void *realloc_pj(void *ptr, size_t s);
void free_pj(void *ptr);
FILE *fopen_with_path(const char *path, const char *mode);
#endif /* CMPROTO_DEFINED */

View File

@ -1019,7 +1019,7 @@ void cm_d_source(ARGS)
/*** open file and count the number of vectors in it ***/
source = fopen( PARAM(input_file), "r");
source = fopen_with_path( PARAM(input_file), "r");
/* increment counter if not a comment until EOF reached... */
i = 0;

View File

@ -1779,7 +1779,7 @@ void cm_d_state(ARGS)
/*** open file and count the number of vectors in it ***/
state_file = fopen( PARAM(state_file), "r");
state_file = fopen_with_path( PARAM(state_file), "r");
/* increment counter if not a comment until EOF reached... */
i = 0;

View File

@ -388,3 +388,29 @@ void * trealloc(void *ptr, size_t s) {
void txfree(void *ptr) {
(coreitf->dllitf_txfree)(ptr);
}
#include <stdlib.h>
#include <string.h>
#define MAX_PATH_LEN 1024
FILE *fopen_with_path(const char *path, const char *mode)
{
char buf[MAX_PATH_LEN+1];
if(path[0] != '/') {
const char *x = getenv("ngspice_vpath");
if(x) {
char *a;
strcpy(buf, x);
a = strrchr(buf, '/');
if(a && a[1] == '\0')
a[0] = '\0';
strcat(buf, "/");
strcat(buf, path);
path = buf;
}
}
return fopen(path, mode);
}

View File

@ -1,5 +1,19 @@
#!/bin/sh
# set -x
if [ -z "$SPICE_SCRIPTS" ] ; then
SPICE_SCRIPTS=`dirname $0`
export SPICE_SCRIPTS
if [ -z "$ngspice_vpath" ] ; then
ngspice_vpath=.
export ngspice_vpath
fi
fi
# ls -ld $(realpath $SPICE_SCRIPTS) $SPICE_SCRIPTS/spinit
# echo "---ngspice_vpath = $ngspice_vpath"
SPICE=$1
TEST=$2

4
tests/bin/spinit Normal file
View File

@ -0,0 +1,4 @@
* due to a broken implementation of the ngspice frontend
* this environment variable must be lower-case
set sourcepath = ( $ngspice_vpath . )

View File

@ -17,7 +17,7 @@ TESTS = \
test14.cir
TESTS_ENVIRONMENT = $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice
TESTS_ENVIRONMENT = ngspice_vpath=$(srcdir) $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice
EXTRA_DIST = \
modelcard.nmos \

View File

@ -12,7 +12,7 @@ TESTS = \
inv_dc.cir \
inv_tr.cir
TESTS_ENVIRONMENT = $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice
TESTS_ENVIRONMENT = ngspice_vpath=$(srcdir) $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice
EXTRA_DIST = \
nmos4p3.mod \

View File

@ -7,7 +7,7 @@ TESTS = \
inv2.cir \
RampVg2.cir
TESTS_ENVIRONMENT = $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice
TESTS_ENVIRONMENT = ngspice_vpath=$(srcdir) $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice
EXTRA_DIST = \
nmosdd.mod \

View File

@ -7,7 +7,7 @@ TESTS = \
inv2.cir \
RampVg2.cir
TESTS_ENVIRONMENT = $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice
TESTS_ENVIRONMENT = ngspice_vpath=$(srcdir) $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice
EXTRA_DIST = \
nmosfd.mod \

View File

@ -7,7 +7,7 @@ TESTS = \
inv2.cir \
RampVg2.cir
TESTS_ENVIRONMENT = $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice
TESTS_ENVIRONMENT = ngspice_vpath=$(srcdir) $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice
EXTRA_DIST = \
nmospd.mod \

View File

@ -21,7 +21,7 @@ TESTS = \
opamp.cir \
ro_17.cir
TESTS_ENVIRONMENT = $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice
TESTS_ENVIRONMENT = ngspice_vpath=$(srcdir) $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice
EXTRA_DIST = \
modelcard.nmos \

View File

@ -5,7 +5,7 @@ TESTS = \
d_source.cir \
d_state.cir
TESTS_ENVIRONMENT = SPICE_SCRIPTS=$(srcdir) $(SHELL) $(top_srcdir)/tests/bin/check.sh "$(top_builddir)/src/ngspice -r foobaz"
TESTS_ENVIRONMENT = ngspice_vpath=$(srcdir) SPICE_SCRIPTS=. $(SHELL) $(top_srcdir)/tests/bin/check.sh "$(top_builddir)/src/ngspice -r foobaz"
EXTRA_DIST = \
d_ram-stimulus.txt \

View File

@ -1 +1,2 @@
codemodel @top_builddir@/src/xspice/icm/digital/digital.cm
set sourcepath = ( $ngspice_vpath . )