all.sh: Move definitions of PSA core and builtin source paths

Move the definitions of PSA core and builtin
source paths to pre_initialize_variables
where they are merged with the definition
of the configuration file paths.

Add the 3.6 case by the way as
pre_initialize_variables is planned to
be in the all.sh part that will land in
mbedtls-framework at some point.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh
index 7e09f18..b2f6bf2 100755
--- a/tests/scripts/all.sh
+++ b/tests/scripts/all.sh
@@ -133,10 +133,18 @@
 pre_initialize_variables () {
     if in_mbedtls_repo; then
         CONFIG_H='include/mbedtls/mbedtls_config.h'
-        CRYPTO_CONFIG_H='tf-psa-crypto/include/psa/crypto_config.h'
+        if [ -d tf-psa-crypto ]; then
+            CRYPTO_CONFIG_H='tf-psa-crypto/include/psa/crypto_config.h'
+            PSA_CORE_PATH='tf-psa-crypto/core'
+            BUILTIN_SRC_PATH='tf-psa-crypto/drivers/builtin/src'
+        else
+            CRYPTO_CONFIG_H='include/psa/crypto_config.h'
+        fi
     else
         CONFIG_H='drivers/builtin/include/mbedtls/mbedtls_config.h'
         CRYPTO_CONFIG_H='include/psa/crypto_config.h'
+        PSA_CORE_PATH='core'
+        BUILTIN_SRC_PATH='drivers/builtin/src'
     fi
     CONFIG_TEST_DRIVER_H='tests/include/test/drivers/config_test_driver.h'
 
@@ -449,8 +457,12 @@
 
     msg "size: ARM Compiler 6 ($FLAGS)"
     "$ARMC6_FROMELF" -z library/*.o
-    "$ARMC6_FROMELF" -z ${PSA_CORE_PATH}/*.o
-    "$ARMC6_FROMELF" -z ${BUILTIN_SRC_PATH}/*.o
+    if [ -n ${PSA_CORE_PATH} ]; then
+        "$ARMC6_FROMELF" -z ${PSA_CORE_PATH}/*.o
+    fi
+    if [ -n ${BUILTIN_SRC_PATH} ]; then
+        "$ARMC6_FROMELF" -z ${BUILTIN_SRC_PATH}/*.o
+    fi
 }
 
 err_msg()
@@ -1101,9 +1113,6 @@
 #### Basic checks
 ################################################################
 
-export PSA_CORE_PATH="tf-psa-crypto/core"
-export BUILTIN_SRC_PATH="tf-psa-crypto/drivers/builtin/src"
-
 #
 # Test Suites to be executed
 #