Skip to content

Commit

Permalink
makefile: fix bad build flags
Browse files Browse the repository at this point in the history
Fix mistake in the Makefile which prevents the version field (as well as
some other build flags) from being passed to "go build". Update the
"runc --version" integration test to make sure that the contents of
VERSION are actually present.

Fixes: 6fbd32e ("Make Makefile more portable")
Signed-off-by: Aleksa Sarai <[email protected]>
  • Loading branch information
cyphar committed Apr 12, 2021
1 parent ea57e3b commit a5d1ee1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ BASE_LDFLAGS := -s -w -X ${PROJECT}.gitCommit=${COMMIT} -X ${PROJECT}.version=${

# Specific build flags for build type.
ifeq ($(GOOS), linux)
TEST_BUILD_FLAGS := ${BASE_FLAGS} -buildmode=pie -ldflags "${BASE_LDFLAGS} -X ${PROJECT}/pkg/testutils.binaryType=test" DYN_BUILD_FLAGS := ${BASE_FLAGS} -buildmode=pie -ldflags "${BASE_LDFLAGS}"
DYN_BUILD_FLAGS := ${BASE_FLAGS} -buildmode=pie -ldflags "${BASE_LDFLAGS}"
TEST_BUILD_FLAGS := ${BASE_FLAGS} -buildmode=pie -ldflags "${BASE_LDFLAGS} -X ${PROJECT}/pkg/testutils.binaryType=test"
else
DYN_BUILD_FLAGS := ${BASE_FLAGS} -ldflags "${BASE_LDFLAGS}"
Expand Down
6 changes: 4 additions & 2 deletions test/help.bats
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
load helpers

@test "umoci --version" {
VERSION="$(cat "$INTEGRATION_ROOT/../VERSION")"

umoci --version
[ "$status" -eq 0 ]
[[ "$output" =~ "umoci version "+ ]]
[[ "$output" =~ "umoci version $VERSION"+ ]]

umoci -v
[ "$status" -eq 0 ]
[[ "$output" =~ "umoci version "+ ]]
[[ "$output" =~ "umoci version $VERSION"+ ]]
}

@test "umoci --help" {
Expand Down

0 comments on commit a5d1ee1

Please sign in to comment.