tools: easier building and testing with multiple GHC versions
This commit is contained in:
		
							parent
							
								
									0616499b97
								
							
						
					
					
						commit
						e093431b4d
					
				
							
								
								
									
										28
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								Makefile
									
									
									
									
									
								
							| @ -159,6 +159,16 @@ hledgerall: bin/hledger hledger-web hledger-vty hledger-chart | |||||||
| bin/hledger: | bin/hledger: | ||||||
| 	cd hledger; ghc --make $(MAIN) -o ../bin/hledger $(BUILDFLAGS) | 	cd hledger; ghc --make $(MAIN) -o ../bin/hledger $(BUILDFLAGS) | ||||||
| 
 | 
 | ||||||
|  | # build a GHC-version-specific hledger binary without disturbing with other GHC version builds
 | ||||||
|  | bin/hledger.ghc-%: | ||||||
|  | 	cd hledger; ghc-$* --make $(MAIN) -o ../$@ $(BUILDFLAGS)  -outputdir .ghc-$* | ||||||
|  | 
 | ||||||
|  | # build hledger with the main supported GHC versions
 | ||||||
|  | hledger-all-ghcs: \ | ||||||
|  | 	bin/hledger.ghc-7.0.4 \
 | ||||||
|  | 	bin/hledger.ghc-7.2.2 \
 | ||||||
|  | 	bin/hledger.ghc-7.4.1 \
 | ||||||
|  | 
 | ||||||
| # build the fastest binary we can
 | # build the fastest binary we can
 | ||||||
| hledgeropt: | hledgeropt: | ||||||
| 	cd hledger; ghc --make $(MAIN) -o bin/hledgeropt $(BUILDFLAGS) -O2 # -fvia-C # -fexcess-precision -optc-O3 -optc-ffast-math | 	cd hledger; ghc --make $(MAIN) -o bin/hledgeropt $(BUILDFLAGS) -O2 # -fvia-C # -fexcess-precision -optc-O3 -optc-ffast-math | ||||||
| @ -312,25 +322,41 @@ hlinttest hlint: | |||||||
| unittest: unittest-builtin | unittest: unittest-builtin | ||||||
| 
 | 
 | ||||||
| unittest-builtin: bin/hledger | unittest-builtin: bin/hledger | ||||||
|  | 	@echo unit tests: | ||||||
| 	@(bin/hledger test \
 | 	@(bin/hledger test \
 | ||||||
| 		&& echo $@ PASSED) || echo $@ FAILED | 		&& echo $@ PASSED) || echo $@ FAILED | ||||||
| 
 | 
 | ||||||
| # XXX doesn't rebuild on hledger source changes
 | # XXX doesn't rebuild on hledger source changes
 | ||||||
| unittest-standalone: tools/unittest | unittest-standalone: tools/unittest | ||||||
|  | 	@echo unit tests (standalone): | ||||||
| 	@(tools/unittest \
 | 	@(tools/unittest \
 | ||||||
| 		&& echo $@ PASSED) || echo $@ FAILED | 		&& echo $@ PASSED) || echo $@ FAILED | ||||||
| 
 | 
 | ||||||
| # run unit tests without waiting for compilation
 | # run unit tests without waiting for compilation
 | ||||||
| unittesths: | unittest-interpreted: | ||||||
|  | 	@echo unit tests (interpreted): | ||||||
| 	@(runghc $(MAIN) test \
 | 	@(runghc $(MAIN) test \
 | ||||||
| 		&& echo $@ PASSED) || echo $@ FAILED | 		&& echo $@ PASSED) || echo $@ FAILED | ||||||
| 
 | 
 | ||||||
| # run functional tests, requires shelltestrunner >= 0.9 from hackage
 | # run functional tests, requires shelltestrunner >= 0.9 from hackage
 | ||||||
| # 16 threads sometimes gives "commitAndReleaseBuffer: resource vanished (Broken pipe)" here but seems harmless
 | # 16 threads sometimes gives "commitAndReleaseBuffer: resource vanished (Broken pipe)" here but seems harmless
 | ||||||
| functest: bin/hledger | functest: bin/hledger | ||||||
|  | 	@echo functional tests: | ||||||
| 	(shelltest tests -- --threads=16 --hide-successes \
 | 	(shelltest tests -- --threads=16 --hide-successes \
 | ||||||
| 		&& echo $@ PASSED) || echo $@ FAILED | 		&& echo $@ PASSED) || echo $@ FAILED | ||||||
| 
 | 
 | ||||||
|  | # run unit and functional tests with a specific GHC version
 | ||||||
|  | test-ghc-%: # bin/hledger.ghc-$*
 | ||||||
|  | 	@echo testing with ghc version $* | ||||||
|  | 	@(echo unit tests: \
 | ||||||
|  | 	&& bin/hledger.ghc-$* test \
 | ||||||
|  | 	&& echo functional tests: \
 | ||||||
|  | 	&& shelltest tests -w bin/hledger.ghc-$* -- --threads=16 --hide-successes \
 | ||||||
|  | 	&& echo $@ PASSED) || echo $@ FAILED | ||||||
|  | 
 | ||||||
|  | # run unit and functional tests with main supported GHC versions
 | ||||||
|  | test-ghc-all: test-ghc-7.0.4 test-ghc-7.2.2 test-ghc-7.4.1 | ||||||
|  | 
 | ||||||
| # run doc tests
 | # run doc tests
 | ||||||
| DOCTESTFILES=\
 | DOCTESTFILES=\
 | ||||||
| 	hledger/Hledger/Cli/Tests.hs | 	hledger/Hledger/Cli/Tests.hs | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user