summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-08-20 22:47:07 +0700
committerShulhan <ms@kilabit.info>2022-08-20 22:47:07 +0700
commitc4a836ba29422c0c4bdc45e955fc623c5432d49b (patch)
treeb24722a628ec86297baa8ddd6cd541ea75eb880a
parentb989345275c1e44eefe0e5e5fc5a37b09bf4b48c (diff)
downloadciigo-c4a836ba29422c0c4bdc45e955fc623c5432d49b.tar.xz
all: add tasks to setup test inside systemd container
When running test inside container, sometimes its success, most of the time its fail. In order to replicate it we need to setup the same container environment and inspect it.
-rw-r--r--Makefile19
1 files changed, 18 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 9054629..b2dc909 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ lint:
test:
go run ./cmd/ciigo-example embed
- CGO_ENABLED=1 go test -v -race ./...
+ CGO_ENABLED=1 go test -failfast -v -race -p=1 ./...
install: build
mv _bin/ciigo $(GOBIN)
@@ -25,3 +25,20 @@ run-example:
build:
mkdir -p $(DIR_BUILD)
CGO_ENABLED=0 go build $(LDFLAGS) -o $(DIR_BUILD) ./cmd/...
+
+.PHONY: chroot-setup chroot-test
+
+chroot-setup:
+ sudo mkdir -p /var/lib/machines/arch.test
+ sudo pacstrap -c /var/lib/machines/arch.test base-devel systemd go
+ sudo mkdir /var/lib/machines/arch.test/root/ciigo
+
+chroot-test:
+ sudo rsync -r . /var/lib/machines/arch.test/root/ciigo/
+ sudo systemd-nspawn --bind=/tmp \
+ --bind=$${HOME}/go/pkg:/root/go/pkg \
+ --bind=$${PWD}/../share:/root/share \
+ --bind=$${HOME}/.cache/go-build:/root/.cache/go-build \
+ -D /var/lib/machines/arch.test \
+ make -C /root/ciigo test
+ #sh -c "rm -rf /root/test; mkdir /root/test; stat /root/test; sleep 1; touch /root/test/file; stat /root/test"