TEST = ../../../../rtest -v

TESTFILES = \
ThermoSysPro.Examples.SimpleExamples.TestAirHumidity.mos \
ThermoSysPro.Examples.SimpleExamples.TestBend.mos \
ThermoSysPro.Examples.SimpleExamples.TestCentrifugalPump4.mos \
ThermoSysPro.Examples.SimpleExamples.TestCentrifugalPump.mos \
ThermoSysPro.Examples.SimpleExamples.TestCentrifugalPumpWaterSolution.mos \
ThermoSysPro.Examples.SimpleExamples.TestCheckValve.mos \
ThermoSysPro.Examples.SimpleExamples.TestControlValve.mos \
ThermoSysPro.Examples.SimpleExamples.TestDiaphragm.mos \
ThermoSysPro.Examples.SimpleExamples.TestDynamicDrum.mos \
ThermoSysPro.Examples.SimpleExamples.TestDynamicOnePhaseFlowPipe.mos \
ThermoSysPro.Examples.SimpleExamples.TestDynamicWaterWaterExchanger.mos \
ThermoSysPro.Examples.SimpleExamples.TestFlueGasesJunctions.mos \
ThermoSysPro.Examples.SimpleExamples.TestFlueGasesVolumes.mos \
ThermoSysPro.Examples.SimpleExamples.TestIdealCheckValve.mos \
ThermoSysPro.Examples.SimpleExamples.TestIdealSwitchValve.mos \
ThermoSysPro.Examples.SimpleExamples.TestInvSingularPressureLoss.mos \
ThermoSysPro.Examples.SimpleExamples.TestJunctions2.mos \
ThermoSysPro.Examples.SimpleExamples.TestJunctions4.mos \
ThermoSysPro.Examples.SimpleExamples.TestJunctions.mos \
ThermoSysPro.Examples.SimpleExamples.TestMassFlowMultiplier.mos \
ThermoSysPro.Examples.SimpleExamples.TestPipePressureLoss.mos \
ThermoSysPro.Examples.SimpleExamples.TestRefP.mos \
ThermoSysPro.Examples.SimpleExamples.TestSensors.mos \
ThermoSysPro.Examples.SimpleExamples.TestSimpleEvaporatorWaterSteamFlueGases.mos \
ThermoSysPro.Examples.SimpleExamples.TestSimpleStaticCondenser.mos \
ThermoSysPro.Examples.SimpleExamples.TestStaticCentrifugalPump1.mos \
ThermoSysPro.Examples.SimpleExamples.TestStaticCentrifugalPump2.mos \
ThermoSysPro.Examples.SimpleExamples.TestStaticCentrifugalPump.mos \
ThermoSysPro.Examples.SimpleExamples.TestStaticCentrifugalPumpWaterSolution.mos \
ThermoSysPro.Examples.SimpleExamples.TestStaticCondenser.mos \
ThermoSysPro.Examples.SimpleExamples.TestStaticDrum2.mos \
ThermoSysPro.Examples.SimpleExamples.TestStaticExchangerWaterSteamFlueGases.mos \
ThermoSysPro.Examples.SimpleExamples.TestStaticWaterWaterExchangerDTorWorEff.mos \
ThermoSysPro.Examples.SimpleExamples.TestStaticWaterWaterExchanger.mos \
ThermoSysPro.Examples.SimpleExamples.TestSteamEngine.mos \
ThermoSysPro.Examples.SimpleExamples.TestStodolaTurbine2.mos \
ThermoSysPro.Examples.SimpleExamples.TestStodolaTurbine.mos \
ThermoSysPro.Examples.SimpleExamples.TestThreeWayValve.mos \
ThermoSysPro.Examples.SimpleExamples.TestVolumes2.mos

# test that currently fail. Move up when fixed. 
# Run make testfailing
FAILINGTESTFILES=  \
ThermoSysPro.Examples.CombinedCyclePowerPlant.CombinedCycle_Load_100_50.mos \
ThermoSysPro.Examples.CombinedCyclePowerPlant.CombinedCycle_TripTAC.mos \
ThermoSysPro.Examples.SimpleExamples.TestCentrifugalPump7.mos \
ThermoSysPro.Examples.SimpleExamples.TestCompressor.mos \
ThermoSysPro.Examples.SimpleExamples.TestDynamicCentrifugalPump.mos \
ThermoSysPro.Examples.SimpleExamples.TestDynamicCentrifugalPump1.mos \
ThermoSysPro.Examples.SimpleExamples.TestDynamicCentrifugalPump2.mos \
ThermoSysPro.Examples.SimpleExamples.TestDynamicCheckValve.mos \
ThermoSysPro.Examples.SimpleExamples.TestDynamicWaterHeating.mos \
ThermoSysPro.Examples.SimpleExamples.TestFan.mos \
ThermoSysPro.Examples.SimpleExamples.TestFlueGasesVolumes1.mos \
ThermoSysPro.Examples.SimpleExamples.TestJunctions3.mos \
ThermoSysPro.Examples.SimpleExamples.TestJunctions5.mos \
ThermoSysPro.Examples.SimpleExamples.TestLumpedStraightPipe.mos \
ThermoSysPro.Examples.SimpleExamples.TestNTUWaterHeating0.mos \
ThermoSysPro.Examples.SimpleExamples.TestNTUWaterHeating1.mos \
ThermoSysPro.Examples.SimpleExamples.TestNTUWaterHeating2.mos \
ThermoSysPro.Examples.SimpleExamples.TestStodolaTurbine3.mos \
ThermoSysPro.Examples.SimpleExamples.TestVolumes.mos \
ThermoSysPro.Examples.SimpleExamples.TestVolumes1.mos \
ThermoSysPro.Examples.SimpleExamples.TestWaterHammer.mos \

# Dependency files that are not .mo .mos or Makefile
# Add them here or they will be cleaned.
DEPENDENCIES = \
 *.mo \
 *.mos \
 *.mat \
 Makefile 
	

CLEAN = `ls | grep -w -v -f deps.tmp`

.PHONY : test clean getdeps

test :
	@echo
	@echo Running tests...
	@echo
	@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) "
	@$(TEST) $(TESTFILES)

# Cleans all files that are not listed as dependencies 
clean :
	@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
	@rm -f $(CLEAN)

# Run this if you want to list out the files (dependencies).
# do it after cleaning and updating the folder
# then you can get a list of file names (which must be dependencies
# since you got them from repository + your own new files)
# then add them to the DEPENDENCIES. You can find the 
# list in deps.txt 
getdeps: 
	@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
	@echo $(CLEAN) | sed -r 's/deps.txt|deps.tmp//g' | sed 's/ / \\\n/g' > deps.txt	
	@echo Dependency list saved in deps.txt.
	@echo Copy the list from deps.txt and add it to the Makefile @DEPENDENCIES
	
failingtest :
	@echo
	@echo Running failing tests...
	@echo
	@$(TEST) $(FAILINGTESTFILES) \
