]> www.wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Don't put test results or intermediary files in the source tree
authorRichard Levitte <richard@levitte.org>
Tue, 30 Mar 2021 18:40:37 +0000 (20:40 +0200)
committerDmitry Belyavskiy <beldmit@users.noreply.github.com>
Tue, 30 Mar 2021 20:06:04 +0000 (23:06 +0300)
When building in a directory that's separate from the source
directory, test results should end up in the build directory, not the
source directory.

Essentially, unless you do build in the source directory, it should be
regarded as read-only when building.

CMakeLists.txt
tcl_tests/dgst.try
tcl_tests/enc.try
tcl_tests/mac.try
tcl_tests/ossltest.tcl
tcl_tests/runtest.sh

index c870045a2b64b0f491eb65c2d293958ba8317e23..2f6c8b50642ebe9ba09a25d7cd13db2048048b25 100644 (file)
@@ -312,7 +312,12 @@ add_custom_target(tags
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
 
 add_custom_target(tcl_tests
-    COMMAND ENGINE_DIR=${OUTPUT_DIRECTORY} sh ./runtest.sh
+    COMMAND OPENSSL_LIBCRYPTO=${OPENSSL_CRYPTO_LIBRARY}
+            OPENSSL_APP=${OPENSSL_PROGRAM}
+            TESTSRC=${CMAKE_SOURCE_DIR}/tcl_tests
+            TESTDIR=${CMAKE_BINARY_DIR}/tcl_tests
+            ENGINE_DIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+            sh ./runtest.sh
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tcl_tests)
 
 add_executable(test_tlstree test_tlstree.c)
index 21c2ca7fd29a8fe3377809b8dd7fc214bd01da3e..77d6365a28b7f98f563c170f1bf9939202a7f23b 100644 (file)
@@ -25,7 +25,7 @@ test -createsfiles {dgst.dat dgst0.dat dgst2.dat dgst8.dat dgst63.dat dgst_CF.da
        makeFile dgst.dat [string repeat "Test data to digest.\n" 100] binary
        makeFile dgst0.dat "" binary
        makeFile dgst63.dat "012345678901234567890123456789012345678901234567890123456789012" binary
-       file copy -force ../dgst_CF.dat ../dgst_ex1.dat ../dgst_ex2.dat .
+       file copy -force $::test::src/dgst_CF.dat $::test::src/dgst_ex1.dat $::test::src/dgst_ex2.dat .
 } 0 ""
 
 test "Вычисление дайджеста алгоритмом md_gost12_256" {
index ffe9baf1f369175ff3343e13d1e0e532704c7ed6..054ca8c19fc950262999bb9b91d88ed1aad404b4 100644 (file)
@@ -2,13 +2,13 @@
 lappend auto_path [file dirname [info script]] 
 package require ossltest
 set plain0 [getFile plain.enc]
-file copy -force cfb0.enc $::test::dir
-file copy -force cnt0.enc $::test::dir
-file copy -force cbc0.enc $::test::dir
-file copy -force aes0.enc $::test::dir
-file copy -force plain.enc $::test::dir
-file copy -force magma_plain.enc $::test::dir
-file copy -force magma_acpkm_plain.enc $::test::dir
+file copy -force $::test::src/cfb0.enc $::test::dir
+file copy -force $::test::src/cnt0.enc $::test::dir
+file copy -force $::test::src/cbc0.enc $::test::dir
+file copy -force $::test::src/aes0.enc $::test::dir
+file copy -force $::test::src/plain.enc $::test::dir
+file copy -force $::test::src/magma_plain.enc $::test::dir
+file copy -force $::test::src/magma_acpkm_plain.enc $::test::dir
 set cfb1 [getFile cfb1.enc]
 set cbc1 [getFile cbc1.enc]
 set cnt1 [getFile cnt1.enc]
index 908d75b5f605ccecaef8fe0e87885e5777cb6169..8305f5dbff99bfdf64f8895c72e83a6a260f343c 100644 (file)
@@ -10,7 +10,7 @@ test -createsfiles {dgst.dat dgst0.dat dgst2.dat dgst8.dat dgst63.dat mac-grassh
        makeFile dgst2.dat [string repeat "1\n" 1] binary
        makeFile dgst8.dat [string repeat "1\n" 4] binary
        makeFile dgst63.dat "012345678901234567890123456789012345678901234567890123456789012" binary
-       file copy -force ../mac-grasshopper.dat ../mac-magma.dat .
+       file copy -force $::test::src/mac-grasshopper.dat $::test::src/mac-magma.dat .
 } 0 ""
 
 test "Вычисление HMAC(md_gost12_512)" {
index a6f02836c09b80284b48701c88947f63833a8927..792c0718e35c409840b73b8d71bdcc8e06822423 100644 (file)
@@ -61,6 +61,16 @@ package require test
 set test::suffix ""
 package require base64
 
+#
+# set  up test::src variable
+#
+
+if {[info exists env(TESTSRC)]} {
+       set ::test::src [file normalize $env(TESTSRC)]
+} else {
+       set ::test::src [pwd]
+}      
+
 #
 # set  up test::dir variable
 #
index 9ad744bf6c3315869f526e6e00950d83238fe3bf..9969102d711c1935929b1e75441876cdd1f5aa5d 100644 (file)
 
 CRYPTOPACK_MAIN_VERSION=3
 
+if [ -n "$OPENSSL_LIBCRYPTO" ]; then
+    libdir=`dirname $OPENSSL_LIBCRYPTO`
+    # Linux, ELF HP-UX
+    LD_LIBRARY_PATH=${libdir}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
+    export LD_LIBRARY_PATH
+    # MacOS X
+    DYLD_LIBRARY_PATH=${libdir}${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
+    export DYLD_LIBRARY_PATH
+fi
 : ${OPENSSL_APP:=$(which openssl 2>/dev/null)}
 if [ -z "$OPENSSL_APP" ]; then
        if [ "$OS" != "Windows NT" -a "$OS" != "Windows_NT" ]; then
@@ -79,10 +88,11 @@ APP_SUFFIX=`basename $OPENSSL_APP .exe|sed s/openssl//`
 [ -n "$OPENSSL_APP" ]&& export OPENSSL_APP
 ENGINE_NAME=`$TCLSH getengine.tcl`
 export ENGINE_NAME
-TESTDIR=`hostname`-$ENGINE_NAME
+[ -z "$TESTDIR" ] && TESTDIR=`pwd`
+TESTDIR=${TESTDIR}/`hostname`-$ENGINE_NAME
 [ -n "$APP_SUFFIX" ] && TESTDIR=${TESTDIR}-${APP_SUFFIX}
 [ -d ${TESTDIR} ] && rm -rf ${TESTDIR}
-mkdir ${TESTDIR}
+mkdir -p ${TESTDIR}
 cp oidfile ${TESTDIR}
 export TESTDIR