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.
This commit is contained in:
@@ -69,6 +69,9 @@ def pytest_configure(config):
|
|||||||
option.architecture = platform.architecture()[0]
|
option.architecture = platform.architecture()[0]
|
||||||
option.system = platform.system()
|
option.system = platform.system()
|
||||||
|
|
||||||
|
option.cache_dir = tempfile.mkdtemp(prefix='unit-test-cache-')
|
||||||
|
public_dir(option.cache_dir)
|
||||||
|
|
||||||
# set stdout to non-blocking
|
# set stdout to non-blocking
|
||||||
|
|
||||||
if option.detailed or option.print_log:
|
if option.detailed or option.print_log:
|
||||||
@@ -434,3 +437,4 @@ def is_su(request):
|
|||||||
|
|
||||||
def pytest_sessionfinish(session):
|
def pytest_sessionfinish(session):
|
||||||
unit_stop()
|
unit_stop()
|
||||||
|
shutil.rmtree(option.cache_dir)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class TestApplicationGo(TestApplicationProto):
|
|||||||
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env['GOPATH'] = option.current_dir + '/build/go'
|
env['GOPATH'] = option.current_dir + '/build/go'
|
||||||
|
env['GOCACHE'] = option.cache_dir + '/go'
|
||||||
|
|
||||||
if static:
|
if static:
|
||||||
args = [
|
args = [
|
||||||
|
|||||||
Reference in New Issue
Block a user