Skip to content

Commit d46e51a

Browse files
Naoya Horiguchichristo4ferris
Naoya Horiguchi
authored andcommitted
[FAB-5985] unit-test: introduce verbose mode
rebased on master and add new verbose mode to modified run.sh. Verbose mode can be run with: VERBOSE=1 make unit-tests Change-Id: I492fffdd7891e696fb202efc9de79e0d9c7854b2 Signed-off-by: Christopher Ferris <chrisfer@us.ibm.com> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
1 parent 8e98cdc commit d46e51a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

unit-test/docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ unit-tests:
1313
- OUTPUT
1414
- TEST_PKGS=${TEST_PKGS}
1515
- CORE_VM_DOCKER_ATTACHSTDOUT=true
16+
- VERBOSE
1617
- JOB_TYPE=${JOB_TYPE}
1718
volumes:
1819
- /var/run/docker.sock:/var/run/docker.sock

unit-test/run.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,19 @@ serial_test_packages() {
6464
# will be tested in parallel
6565
run_tests() {
6666
echo ${GO_TAGS}
67+
flags="-cover"
68+
if [ -n "${VERBOSE}" ]; then
69+
flags="-v -cover"
70+
fi
71+
6772
local parallel=$(parallel_test_packages "$@")
6873
if [ -n "${parallel}" ]; then
69-
time go test -cover -tags "$GO_TAGS" -ldflags "$GO_LDFLAGS" ${parallel[@]} -short -timeout=20m
74+
time go test ${flags} -tags "$GO_TAGS" -ldflags "$GO_LDFLAGS" ${parallel[@]} -short -timeout=20m
7075
fi
7176

7277
local serial=$(serial_test_packages "$@")
7378
if [ -n "${serial}" ]; then
74-
time go test -cover -tags "$GO_TAGS" -ldflags "$GO_LDFLAGS" ${serial[@]} -short -p 1 -timeout=20m
79+
time go test ${flags} -tags "$GO_TAGS" -ldflags "$GO_LDFLAGS" ${serial[@]} -short -p 1 -timeout=20m
7580
fi
7681
}
7782

0 commit comments

Comments
 (0)