makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. #
  2. # $Id$
  3. #
  4. # make all test
  5. # and printout errors
  6. all : clean allts alltf allto alltest
  7. grep -n -i fails log
  8. # returns the error code
  9. # of the command line
  10. # in file retcode
  11. ifdef DJGPP
  12. EXEEXT=.exe
  13. getreturncode :
  14. redir -e $(FILE).log -o $(FILE).log getret $(COMMAND)
  15. cp retcode $(FILE).$(RESEXT)
  16. else
  17. EXEEXT=
  18. getreturncode :
  19. getret $(COMMAND) !> $(FILE).log !2>$(FILE).log
  20. cp retcode $(FILE).$(RESEXT)
  21. endif
  22. RETCODE=$(wildcard retcode*)
  23. # retcode should be between 0 and 255
  24. # 256 is for halt
  25. # 512+doserror if doserror<>0
  26. ifdef RESFILE
  27. RETVAL=$(shell cat $(RESFILE))
  28. else
  29. ifdef RETCODE
  30. RETVAL=$(shell cat retcode)
  31. else
  32. RETVAL=1024
  33. endif
  34. endif
  35. printretcode:
  36. echo Return code of $(FILE) is $(RETVAL)
  37. ifeq ($(RETVAL),0)
  38. testsuccess:
  39. echo Test for $(FILE) success (compiles)
  40. echo Test for $(FILE) success (compiles) >>log
  41. else
  42. testsuccess:
  43. echo Test for $(FILE) fails (does not compile) error $(RETVAL)
  44. echo Test for $(FILE) fails (does not compile) error $(RETVAL)>>log
  45. echo $(FILE) >> faillist
  46. endif
  47. ifdef FILE
  48. ifneq ($wildcard $(FILE).exc),)
  49. EXERETVAL:=$(shell cat $(FILE).exc)
  50. else
  51. EXERETVAL=-1
  52. endif
  53. else
  54. EXERETVAL=-2
  55. endif
  56. ifeq ($(EXERETVAL),0)
  57. testexecsuccess:
  58. echo Test for exec $(FILE) success (runs without error)
  59. echo Test for $(FILE) success (runs without error) >>log
  60. else
  61. testexecsuccess:
  62. echo Test for exec $(FILE) fails exec error $(RETVAL)
  63. echo Test for exec $(FILE) fails exec error $(RETVAL)>>log
  64. echo $(FILE) >> faillist
  65. endif
  66. ifneq ($(wildcard $(FILE)$(EXEEXT)),)
  67. testexec:
  68. redir -e $(FILE).elg -o$(FILE).elg getret $(FILE)$(EXEEXT)
  69. cp retcode $(FILE).exc
  70. make testexecsuccess 'FILE=$(FILE)'
  71. else
  72. testexec:
  73. echo No exefile $(FILE)$(EXEEXT)
  74. make testexecsuccess 'FILE=$(FILE)'
  75. true
  76. endif
  77. ifneq ($(RETVAL),0)
  78. testfail:
  79. echo Test for $(FILE) success (does not compile) error $(RETVAL)
  80. echo Test for $(FILE) success (does not compile) error $(RETVAL)>> log
  81. else
  82. testfail:
  83. echo Test for $(FILE) fails (does compile and should not)
  84. echo Test for $(FILE) fails (does compile and should not) >> log
  85. echo $(FILE) >> faillist
  86. endif
  87. ifndef PP
  88. PP=ppc386
  89. else
  90. export PP
  91. endif
  92. ifndef OPT
  93. OPT=
  94. endif
  95. ifdef FILE
  96. OPTFILE=$(wildcard $(FILE).opt)
  97. endif
  98. ifdef OPTFILE
  99. override OPT+=$(OPTFILE)
  100. endif
  101. ifndef FILE
  102. FILE=ts00001.pp
  103. endif
  104. testone :
  105. make getreturncode 'COMMAND=$(PP) $(OPT) $(FILE).pp' 'RESEXT=$(RESEXT)'
  106. make printretcode 'FILE=$(FILE)'
  107. %.res : %.pp
  108. make testone 'FILE=$*' 'RESEXT=res'
  109. make testsuccess 'FILE=$*' 'RESFILE=$*.res'
  110. %.ref : %.pp
  111. make testone 'FILE=$*' 'RESEXT=ref'
  112. make testfail 'FILE=$*' 'RESFILE=$*.ref'
  113. # exec log files
  114. # creates two files
  115. # *.elg log file
  116. # *.exc exicode of program
  117. %.elg : %.res
  118. make testexec 'FILE=$*'
  119. allts : $(patsubst %.pp,%.res,$(wildcard ts*.pp))
  120. alltest : $(patsubst %.pp,%.res,$(wildcard test*.pp))
  121. alltf : $(patsubst %.pp,%.ref,$(wildcard tf*.pp))
  122. allto : $(patsubst %.pp,%.res,$(wildcard to*.pp))
  123. allexec : alltsexec alltestexec
  124. alltestexec: $(patsubst %.pp,%.elg,$(wildcard test*.pp))
  125. alltsexec: $(patsubst %.pp,%.elg,$(wildcard ts*.pp))
  126. clean :
  127. -rm *.re* *.o *.ppu ts*.exe tf*.exe log faillist
  128. # $Log$
  129. # Revision 1.7 1998-10-22 16:41:11 pierre
  130. # * added two small tests
  131. # iocheck inside iocheck
  132. # enums inside objects
  133. #
  134. # Revision 1.6 1998/10/22 14:35:40 pierre
  135. # + added allexec tests if executables compiled
  136. # don't return with an error code
  137. # * some changes in test files for dos
  138. #
  139. # Revision 1.5 1998/10/21 16:24:16 pierre
  140. # + tests to check if filename exists
  141. #
  142. # Revision 1.4 1998/10/21 12:14:30 pierre
  143. # * stupid error removing getret.exe each time
  144. #
  145. # Revision 1.3 1998/10/21 12:12:09 pierre
  146. # Log inserted
  147. #