Skip to content

Commit

Permalink
Merge pull request #36 from gerlero/makefile
Browse files Browse the repository at this point in the history
Update tests
  • Loading branch information
gerlero authored May 15, 2022
2 parents 7abf8e7 + bb5da1c commit 79e9b1d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 17 deletions.
50 changes: 36 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,44 @@ Brewfile.lock.json: Brewfile


# Non-build targets and rules
test: test-dmg test-shell
test: test-openfoam test-bash test-zsh

test-openfoam:
[ ! -d $(VOLUME) ] || hdiutil detach $(VOLUME)
rm -rf build/test/test-openfoam
mkdir -p build/test/test-openfoam
build/$(APP_NAME).app/Contents/MacOS/openfoam -c foamInstallationTest
cd build/test/test-openfoam \
&& "$(CURDIR)/build/$(APP_NAME).app/Contents/MacOS/openfoam" < "$(CURDIR)/test.sh"
build/$(APP_NAME).app/Contents/MacOS/volume eject && [ ! -d $(VOLUME) ]

test-bash:
[ ! -d $(VOLUME) ] || hdiutil detach $(VOLUME)
rm -rf build/test/test-bash
mkdir -p build/test/test-bash
bash -c \
set -ex; \
source build/$(APP_NAME).app/Contents/MacOS/bashrc; \
foamInstallationTest; \
cd build/test/test-bash; \
source "$(CURDIR)/test.sh"
build/$(APP_NAME).app/Contents/MacOS/volume eject && [ ! -d $(VOLUME) ]

test-zsh:
[ ! -d $(VOLUME) ] || hdiutil detach $(VOLUME)
rm -rf build/test/test-zsh
mkdir -p build/test/test-zsh
zsh -c \
set -ex; \
source build/$(APP_NAME).app/Contents/MacOS/bashrc; \
foamInstallationTest; \
cd build/test/test-zsh; \
source "$(CURDIR)/test.sh"
build/$(APP_NAME).app/Contents/MacOS/volume eject && [ ! -d $(VOLUME) ]

test-dmg:
[ ! -d $(VOLUME) ] || hdiutil detach $(VOLUME)
hdiutil attach build/$(APP_NAME).app/Contents/Resources/$(APP_NAME).dmg \
|| hdiutil attach build/$(APP_NAME).dmg \
|| hdiutil attach build/$(APP_NAME)-build.dmg
hdiutil attach build/$(APP_NAME).dmg
rm -rf build/test/test-dmg
mkdir -p build/test/test-dmg
cd build/test/test-dmg \
Expand All @@ -149,15 +180,6 @@ test-dmg:
&& $(SHELL) -ex "$(CURDIR)/test.sh"
hdiutil detach $(VOLUME)

test-shell:
[ ! -d $(VOLUME) ] || hdiutil detach $(VOLUME)
rm -rf build/test/test-shell
mkdir -p build/test/test-shell
build/$(APP_NAME).app/Contents/MacOS/openfoam -c foamInstallationTest
cd build/test/test-shell \
&& "$(CURDIR)/build/$(APP_NAME).app/Contents/MacOS/openfoam" < "$(CURDIR)/test.sh"
hdiutil detach $(VOLUME)

clean-build:
[ ! -d $(VOLUME) ] || hdiutil detach $(VOLUME)
rm -f build/$(APP_NAME).dmg build/$(APP_NAME)-shrunk.dmg build/$(APP_NAME)-build.dmg build/$(DIST_NAME).zip
Expand All @@ -173,7 +195,7 @@ uninstall:


# Set special targets
.PHONY: app dmg build fetch-source install-dependencies zip install test test-dmg test-shell clean-build clean uninstall
.PHONY: app dmg build fetch-source install-dependencies zip install test test-openfoam test-bash test-zsh test-dmg clean-build clean uninstall
.PRECIOUS: build/$(APP_NAME)-build.dmg
.INTERMEDIATE: build/$(APP_NAME)-shrunk.dmg
.SECONDARY: $(SOURCE_TARBALL) Brewfile.lock.json build/$(APP_NAME)-build.dmg build/$(APP_NAME).dmg
Expand Down
6 changes: 3 additions & 3 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ rm -rf flange2
cp -r "$FOAM_TUTORIALS/basic/laplacianFoam/flange" flange2
cd flange2
foamDictionary -entry numberOfSubdomains -set 2 system/decomposeParDict
$BASH -e ./Allrun-parallel
./Allrun-parallel
reconstructPar
cd ..

rm -rf backwardFacingStep2D
cp -r "$FOAM_TUTORIALS/incompressible/simpleFoam/backwardFacingStep2D" backwardFacingStep2D
cd backwardFacingStep2D
$BASH -e ./Allrun
./Allrun
! grep 'FOAM Warning' log.simpleFoam
cd ..

rm -rf blob
cp -r "$FOAM_TUTORIALS/mesh/foamyHexMesh/blob" blob
cd blob
$BASH -e ./Allrun
./Allrun
cd ..

0 comments on commit 79e9b1d

Please sign in to comment.