summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTiago Natel de Moura <t.nateldemoura@f5.com>2020-12-21 11:00:46 +0000
committerTiago Natel de Moura <t.nateldemoura@f5.com>2020-12-21 11:00:46 +0000
commit03436d2ec2ab485b4f3196690e9a267bf0d42d30 (patch)
tree8eb88b8e5abeb46c5d8cf312899b8e9f080c1f86
parent7b669ed866896afbf26ab6bc0737fe7c8f9c2ec5 (diff)
downloadunit-03436d2ec2ab485b4f3196690e9a267bf0d42d30.tar.gz
unit-03436d2ec2ab485b4f3196690e9a267bf0d42d30.tar.bz2
Tests: introduced a separate cache directory for Go builds.
The Go compiler can't detect changes to C header files when compiling CGO applications, and then this leads to Go test samples being linked with wrong libunit. This patch creates a new cache directory reused throughout the test suite.
Diffstat (limited to '')
-rw-r--r--test/conftest.py4
-rw-r--r--test/unit/applications/lang/go.py1
2 files changed, 5 insertions, 0 deletions
diff --git a/test/conftest.py b/test/conftest.py
index c14e3f68..c2a320de 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -69,6 +69,9 @@ def pytest_configure(config):
option.architecture = platform.architecture()[0]
option.system = platform.system()
+ option.cache_dir = tempfile.mkdtemp(prefix='unit-test-cache-')
+ public_dir(option.cache_dir)
+
# set stdout to non-blocking
if option.detailed or option.print_log:
@@ -434,3 +437,4 @@ def is_su(request):
def pytest_sessionfinish(session):
unit_stop()
+ shutil.rmtree(option.cache_dir)
diff --git a/test/unit/applications/lang/go.py b/test/unit/applications/lang/go.py
index 70f9d58c..a17b1af4 100644
--- a/test/unit/applications/lang/go.py
+++ b/test/unit/applications/lang/go.py
@@ -12,6 +12,7 @@ class TestApplicationGo(TestApplicationProto):
env = os.environ.copy()
env['GOPATH'] = option.current_dir + '/build/go'
+ env['GOCACHE'] = option.cache_dir + '/go'
if static:
args = [