aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Faust <colefaust@google.com>2022-11-25 17:10:27 -0800
committerCole Faust <colecfaust@gmail.com>2022-11-27 19:49:35 -0800
commit1c7fee78f28175988570a6f00decb6d6df45828f (patch)
tree3d5a41536caeafcb937e3936a54ae412f29db477
parent1ff99f5a0c80f22b9cda08df76c48c22a2c9d46b (diff)
downloadkati-1c7fee78f28175988570a6f00decb6d6df45828f.tar.gz
Fix tests for ubuntu 22.04
The version of bash in ubuntu 22.04 says errors occur on line 1 instead of line 0 when using bash -c. Update the tests to handle that.
-rw-r--r--Dockerfile19
-rw-r--r--Makefile4
-rw-r--r--README.md2
-rw-r--r--run_test.go4
4 files changed, 22 insertions, 7 deletions
diff --git a/Dockerfile b/Dockerfile
index b4423be..834e6c0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,16 +1,27 @@
-FROM ubuntu:20.04
+FROM ubuntu:22.04
-RUN apt-get update && apt-get install -y make git-core build-essential curl ninja-build python python3
+RUN apt-get update && apt-get install -y make git-core build-essential curl ninja-build python3 wget
# Install Go
RUN \
mkdir -p /goroot && \
curl https://storage.googleapis.com/golang/go1.14.9.linux-amd64.tar.gz | tar xvzf - -C /goroot --strip-components=1
-# Set environment variables for Go.
+# Install Make, we emulate Make 4.2.1 instead of the default 4.3 currently
+RUN \
+ mkdir -p /make/tmp && \
+ cd /make/tmp && \
+ wget http://mirrors.kernel.org/ubuntu/pool/main/m/make-dfsg/make_4.2.1-1.2_amd64.deb && \
+ ar xv make_4.2.1-1.2_amd64.deb && \
+ tar xf data.tar.xz && \
+ mv usr/bin/make ../ && \
+ cd .. && \
+ rm -rf tmp/
+
+# Set environment variables for Go and Make.
ENV GOROOT /goroot
ENV GOPATH /gopath
-ENV PATH $GOROOT/bin:$GOPATH/bin:$PATH
+ENV PATH $GOROOT/bin:$GOPATH/bin:/make:$PATH
# Copy project code.
COPY . /src
diff --git a/Makefile b/Makefile
index e1b9d46..8766443 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,9 @@ info: ckati
@echo CKATI VERSION
./ckati -f Makefile version
@echo
+ @echo BASH VERSION
+ -/bin/bash --version | head -n 1
+ @echo
@echo SHELL VERSION
@echo $(SHELL)
$(SHELL) --version | head -n 1
@@ -33,6 +36,7 @@ version:
@echo $(MAKE_VERSION)
test: all ckati_tests
+ go test --ckati
go test --ckati --ninja
clean: ckati_clean
diff --git a/README.md b/README.md
index 889abf2..ff3c150 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ $ make ckati
The above command produces a `ckati` binary in the project root.
-Testing (best ran in a Ubuntu 20.04 environment):
+Testing (best ran in a Ubuntu 22.04 environment):
```
$ make test
diff --git a/run_test.go b/run_test.go
index 7c574fc..d115125 100644
--- a/run_test.go
+++ b/run_test.go
@@ -69,7 +69,7 @@ var normalizeMakeLog = []normalization{
// GNU make 4.0 has this output.
{regexp.MustCompile(`Makefile:\d+: commands for target ".*?" failed\n`), ""},
// We treat some warnings as errors.
- {regexp.MustCompile(`/bin/(ba)?sh: line 0: `), ""},
+ {regexp.MustCompile(`/bin/(ba)?sh: line 1: `), ""},
// Normalization for "include foo" with C++ kati
{regexp.MustCompile(`(: \S+: No such file or directory)\n\*\*\* No rule to make target "[^"]+".`), "$1"},
// GNU make 4.0 prints the file:line as part of the error message, e.g.:
@@ -89,7 +89,7 @@ var normalizeKati = []normalization{
// kati specific log messages
{regexp.MustCompile(`\*kati\*[^\n]*`), ""},
{regexp.MustCompile(`c?kati: `), ""},
- {regexp.MustCompile(`/bin/sh: line 0: `), ""},
+ {regexp.MustCompile(`/bin/(ba)?sh: line 1: `), ""},
{regexp.MustCompile(`/bin/sh: `), ""},
{regexp.MustCompile(`.*: warning for parse error in an unevaluated line: [^\n]*`), ""},
{regexp.MustCompile(`([^\n ]+: )?FindEmulator: `), ""},