aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2022-01-04 08:57:42 +1000
committerSteve Bennett <steveb@workware.net.au>2022-02-23 12:26:28 +1000
commitf9be00a014afa3be4e53c62e9b4cd32f066484ba (patch)
treeb45908cec36910c03652095a17192a4cf3ed63ca /tests
parent61b24625cd6c43b2d967b1d563f70d5b3ae8a20a (diff)
downloadjimtcl-f9be00a014afa3be4e53c62e9b4cd32f066484ba.zip
jimtcl-f9be00a014afa3be4e53c62e9b4cd32f066484ba.tar.gz
jimtcl-f9be00a014afa3be4e53c62e9b4cd32f066484ba.tar.bz2
tests: Fix load.test when jimsh not yet installed
Needs include, lib paths when jim is not installed Fixes: #216 Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests')
-rw-r--r--tests/load.test36
1 files changed, 17 insertions, 19 deletions
diff --git a/tests/load.test b/tests/load.test
index 140194f..18361c7 100644
--- a/tests/load.test
+++ b/tests/load.test
@@ -4,22 +4,20 @@ needs cmd load interp
# In order to test loadable modules we need a working build-jim-ext
# (from the same directory as jimsh).
-# If we don't have that, just skip these tests.
+# And to support an uninstalled jimsh, we need to explicitly use jimsh
+# and add an include path to the parent dir and also to the build dir (in case it is different)
+set topdir [file dirname [file dirname [info script]]]
+set builddir [file dirname [info nameofexecutable]]
+set buildjimext [list [info nameofexecutable] [file join $builddir build-jim-ext] -I$topdir -L$topdir -I$builddir -L$builddir]
-set buildjimext [file join [file dirname [info nameofexecutable]] build-jim-ext]
# loadtest.c is in the same directory as this script
set src [file join [file dirname [info script]] loadtest.c]
-set skip 1
-if {[file exec $buildjimext]} {
- set skip [catch {
- exec $buildjimext $src
- }]
- if {!$skip && ![file exists loadtest.so]} {
- set skip 1
- }
-}
-if {$skip} {
+catch {
+ exec {*}$buildjimext $src
+} msg opts
+if {![file exists loadtest.so]} {
+ #puts [errorInfo $msg $opts(-errorinfo)]
skiptest " (no working build-jim-ext)"
}
@@ -35,13 +33,13 @@ test load-1.1 {load initial} {
} {0}
test load-1.2 {create loadable extension} -body {
- exec $buildjimext $src
+ exec {*}$buildjimext $src
file exists loadtest.so
} -result {1}
test load-1.3 {load dynamic extension} -body {
$interp eval {
- load loadtest.so
+ load ./loadtest.so
exists -command loadtest
}
} -result {1}
@@ -73,7 +71,7 @@ $interp delete
test load-2.1 {loadable extension with full path} -body {
set interp [interp]
- exec $buildjimext $src
+ exec {*}$buildjimext $src
$interp eval {
load [pwd]/loadtest.so
loadtest test def
@@ -86,7 +84,7 @@ test load-2.2 {loadable extension without extension} -body {
set interp [interp]
file rename loadtest.so loadtest
$interp eval {
- load loadtest
+ load ./loadtest
loadtest test def
}
} -result {def} -cleanup {
@@ -96,11 +94,11 @@ test load-2.2 {loadable extension without extension} -body {
test load-2.1 {loadable extension with no entrypoint} -body {
set interp [interp]
- exec $buildjimext --notest -DNO_ENTRYPOINT $src
+ exec {*}$buildjimext --notest -DNO_ENTRYPOINT $src
$interp eval {
- load loadtest.so
+ load ./loadtest.so
}
-} -returnCodes error -result {No Jim_loadtestInit symbol found in extension loadtest.so} -cleanup {
+} -returnCodes error -result {No Jim_loadtestInit symbol found in extension ./loadtest.so} -cleanup {
$interp delete
}