Update Makefiles and revert changes to config.pl

-Add comments to Makefiles about test env auto-detection
-Fix indentation
-Remove parent folder from include dirs
-Do not use environment variable for defining config file because
 env variable usage is not fully implemented
-Revert changes to config.pl
diff --git a/tests/Makefile b/tests/Makefile
index bc3aba5..dee011f 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -14,13 +14,11 @@
 	INCLUDE_DIR=-I../include
 else
 	LIBRARY_DIR=../src
-	INCLUDE_DIR=-I.. -I../inc
+	INCLUDE_DIR=-I../inc
+	CFLAGS += "-DMBEDTLS_CONFIG_FILE=\"mbedtls/test_config.h\""
 endif
 
 LOCAL_CFLAGS = $(WARNING_CFLAGS) $(INCLUDE_DIR) -D_FILE_OFFSET_BITS=64
-ifdef MBEDTLS_CONFIG_FILE
-LOCAL_CFLAGS += "-DMBEDTLS_CONFIG_FILE=\"${MBEDTLS_CONFIG_FILE}\""
-endif
 
 LOCAL_LDFLAGS = -L$(LIBRARY_DIR)		\
 		-lmbedtls$(SHARED_SUFFIX)	\
diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh
index 38b1b69..efd1fb3 100755
--- a/tests/ssl-opt.sh
+++ b/tests/ssl-opt.sh
@@ -21,6 +21,18 @@
 
 set -u
 
+# Detect used test environment: Mbed TLS or Mbed OS 
+if [ -f "../include/mbedtls/config.h" ]
+then
+    CONFIG_FILE=../include/mbedtls/config.h
+elif [ -f "../inc/mbedtls/test_config.h" ]
+then
+    CONFIG_FILE=../inc/mbedtls/test_config.h
+else
+    echo "Can't locate config file, must be run from mbed TLS root" >&2
+    exit 1
+fi
+
 # Limit the size of each log to 10 GiB, in case of failures with this script
 # where it may output seemingly unlimited length error logs.
 ulimit -f 20971520
@@ -297,9 +309,9 @@
 }
 
 # Calculate the input & output maximum content lengths set in the config
-MAX_CONTENT_LEN=$( ../scripts/config.pl get MBEDTLS_SSL_MAX_CONTENT_LEN || echo "16384")
-MAX_IN_LEN=$( ../scripts/config.pl get MBEDTLS_SSL_IN_CONTENT_LEN || echo "$MAX_CONTENT_LEN")
-MAX_OUT_LEN=$( ../scripts/config.pl get MBEDTLS_SSL_OUT_CONTENT_LEN || echo "$MAX_CONTENT_LEN")
+MAX_CONTENT_LEN=$( ../scripts/config.pl -f $CONFIG_FILE get MBEDTLS_SSL_MAX_CONTENT_LEN || echo "16384")
+MAX_IN_LEN=$( ../scripts/config.pl -f $CONFIG_FILE get MBEDTLS_SSL_IN_CONTENT_LEN || echo "$MAX_CONTENT_LEN")
+MAX_OUT_LEN=$( ../scripts/config.pl -f $CONFIG_FILE get MBEDTLS_SSL_OUT_CONTENT_LEN || echo "$MAX_CONTENT_LEN")
 
 if [ "$MAX_IN_LEN" -lt "$MAX_CONTENT_LEN" ]; then
     MAX_CONTENT_LEN="$MAX_IN_LEN"