Changeset e16797c


Ignore:
Timestamp:
Apr 8, 2019, 4:19:21 PM (2 years ago)
Author:
tdelisle <tdelisle@…>
Branches:
arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
07ac6d0
Parents:
5a8037a7
Message:

cleaned-up makefile rules required for tests

Location:
tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/Makefile.am

    r5a8037a7 re16797c  
    4141CC = @CFACC@
    4242
    43 PRETTY_PATH=cd ${srcdir} &&
     43PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
    4444
    4545.PHONY: list .validate
     
    8282#----------------------------------------------------------------------------------------------------------------
    8383
     84# Use for all tests, make sure the path are correct and all flags are added
     85CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
     86
     87# Use for tests that either generate an executable, print directyl to stdout or the make command is expected to fail
     88CFATEST_STDOUT=$(CFACOMPILETEST) -o $(abspath ${@})
     89
     90# Use for tests where the make command is expecte to succeed but the expected.txt should be compared to stderr
     91CFATEST_STDERR=$(CFACOMPILETEST) 2> $(abspath ${@})
     92
     93#----------------------------------------------------------------------------------------------------------------
     94
    8495# implicit rule so not all test require a rule
    8596% : %.cfa $(CFACC)
    86         $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     97        $(CFATEST_STDOUT)
    8798
    8899% : %.cpp
    89100        $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    90101
    91 declarationSpecifier: declarationSpecifier.cfa $(CFACC)
    92         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     102#------------------------------------------------------------------------------
     103# TARGET WITH STANDARD RULE BUT CUSTOM FLAGS
     104#------------------------------------------------------------------------------
     105# Expected failures
     106declarationSpecifier_FLAGS= -CFA -XCFA -p
     107gccExtensions_FLAGS= -CFA -XCFA -p
     108extension_FLAGS= -CFA -XCFA -p
     109attributes_FLAGS= -CFA -XCFA -p
     110functions_FLAGS= -CFA -XCFA -p
     111KRfunctions_FLAGS= -CFA -XCFA -p
     112gmp_FLAGS= -lgmp
    93113
    94 gccExtensions : gccExtensions.cfa $(CFACC)
    95         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     114#------------------------------------------------------------------------------
     115# Expected failures
     116completeTypeError_FLAGS= -DERR1
    96117
    97 extension : extension.cfa $(CFACC)
    98         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     118#------------------------------------------------------------------------------
     119# CUSTOM TARGET
     120#------------------------------------------------------------------------------
     121typedefRedef-ERR1: typedefRedef.cfa $(CFACC)
     122        $(CFATEST_STDOUT) -DERR1
    99123
    100 attributes : attributes.cfa $(CFACC)
    101         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     124alloc-ERROR: alloc.cfa $(CFACC)
     125        $(CFATEST_STDOUT) -DERR1
    102126
    103 functions: functions.cfa $(CFACC)
    104         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     127nested-types-ERR1: nested-types.cfa $(CFACC)
     128        $(CFATEST_STDOUT) -DERR1
    105129
    106 KRfunctions : KRfunctions.cfa $(CFACC)
    107         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     130nested-types-ERR2: nested-types.cfa $(CFACC)
     131        $(CFATEST_STDOUT) -DERR2
    108132
    109 sched-ext-parse : sched-ext-parse.c $(CFACC)
    110         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     133raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC)
     134        $(CFATEST_STDOUT) -DERR1
    111135
    112 gmp : gmp.cfa $(CFACC)
    113         $(PRETTY_PATH) $(CFACOMPILE) -lgmp $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     136raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC)
     137        $(CFATEST_STDOUT) -DERR2
     138
     139raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC)
     140        $(CFATEST_STDOUT) -DERR1
     141
     142raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC)
     143        $(CFATEST_STDOUT) -DERR1
    114144
    115145#builtins
    116146builtins/sync: builtins/sync.cfa $(CFACC)
    117         $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only
    118 
    119 #------------------------------------------------------------------------------
    120 
    121 #To make errors path independent we need to cd into the correct directories
    122 completeTypeError : completeTypeError.cfa $(CFACC)
    123         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    124 
    125 typedefRedef-ERR1: typedefRedef.cfa $(CFACC)
    126         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    127 
    128 alloc-ERROR: alloc.cfa $(CFACC)
    129         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    130 
    131 fallthrough-ERROR: fallthrough.cfa $(CFACC)
    132         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    133 
    134 nested-types-ERR1: nested-types.cfa $(CFACC)
    135         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    136 
    137 nested-types-ERR2: nested-types.cfa $(CFACC)
    138         $(PRETTY_PATH) $(CFACOMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    139 
    140 # Constructor/destructor tests
    141 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC)
    142         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    143 
    144 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC)
    145         $(PRETTY_PATH) $(CFACOMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    146 
    147 raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC)
    148         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    149 
    150 raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC)
    151         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     147        $(CFATEST_STDERR) -fsyntax-only
    152148
    153149# Warnings
    154150warnings/self-assignment: warnings/self-assignment.cfa $(CFACC)
    155         $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only
     151        $(CFATEST_STDERR) -fsyntax-only
  • tests/Makefile.in

    r5a8037a7 re16797c  
    384384        -quiet @CFA_FLAGS@ -DIN_DIR="${abs_srcdir}/.in/" \
    385385        ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}
    386 PRETTY_PATH = cd ${srcdir} &&
     386PRETTY_PATH = mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
    387387avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa
    388388# automake doesn't know we still need C/CPP rules so pretend like we have a C program
    389389_dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
     390
     391#----------------------------------------------------------------------------------------------------------------
     392
     393# Use for all tests, make sure the path are correct and all flags are added
     394CFACOMPILETEST = $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
     395
     396# Use for tests that either generate an executable, print directyl to stdout or the make command is expected to fail
     397CFATEST_STDOUT = $(CFACOMPILETEST) -o $(abspath ${@})
     398
     399# Use for tests where the make command is expecte to succeed but the expected.txt should be compared to stderr
     400CFATEST_STDERR = $(CFACOMPILETEST) 2> $(abspath ${@})
     401
     402#------------------------------------------------------------------------------
     403# TARGET WITH STANDARD RULE BUT CUSTOM FLAGS
     404#------------------------------------------------------------------------------
     405# Expected failures
     406declarationSpecifier_FLAGS = -CFA -XCFA -p
     407gccExtensions_FLAGS = -CFA -XCFA -p
     408extension_FLAGS = -CFA -XCFA -p
     409attributes_FLAGS = -CFA -XCFA -p
     410functions_FLAGS = -CFA -XCFA -p
     411KRfunctions_FLAGS = -CFA -XCFA -p
     412gmp_FLAGS = -lgmp
     413
     414#------------------------------------------------------------------------------
     415# Expected failures
     416completeTypeError_FLAGS = -DERR1
    390417all: all-am
    391418
     
    770797# implicit rule so not all test require a rule
    771798% : %.cfa $(CFACC)
    772         $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     799        $(CFATEST_STDOUT)
    773800
    774801% : %.cpp
    775802        $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    776803
    777 declarationSpecifier: declarationSpecifier.cfa $(CFACC)
    778         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    779 
    780 gccExtensions : gccExtensions.cfa $(CFACC)
    781         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    782 
    783 extension : extension.cfa $(CFACC)
    784         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    785 
    786 attributes : attributes.cfa $(CFACC)
    787         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    788 
    789 functions: functions.cfa $(CFACC)
    790         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    791 
    792 KRfunctions : KRfunctions.cfa $(CFACC)
    793         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    794 
    795 sched-ext-parse : sched-ext-parse.c $(CFACC)
    796         $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    797 
    798 gmp : gmp.cfa $(CFACC)
    799         $(PRETTY_PATH) $(CFACOMPILE) -lgmp $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     804#------------------------------------------------------------------------------
     805# CUSTOM TARGET
     806#------------------------------------------------------------------------------
     807typedefRedef-ERR1: typedefRedef.cfa $(CFACC)
     808        $(CFATEST_STDOUT) -DERR1
     809
     810alloc-ERROR: alloc.cfa $(CFACC)
     811        $(CFATEST_STDOUT) -DERR1
     812
     813nested-types-ERR1: nested-types.cfa $(CFACC)
     814        $(CFATEST_STDOUT) -DERR1
     815
     816nested-types-ERR2: nested-types.cfa $(CFACC)
     817        $(CFATEST_STDOUT) -DERR2
     818
     819raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC)
     820        $(CFATEST_STDOUT) -DERR1
     821
     822raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC)
     823        $(CFATEST_STDOUT) -DERR2
     824
     825raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC)
     826        $(CFATEST_STDOUT) -DERR1
     827
     828raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC)
     829        $(CFATEST_STDOUT) -DERR1
    800830
    801831#builtins
    802832builtins/sync: builtins/sync.cfa $(CFACC)
    803         $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only
    804 
    805 #------------------------------------------------------------------------------
    806 
    807 #To make errors path independent we need to cd into the correct directories
    808 completeTypeError : completeTypeError.cfa $(CFACC)
    809         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    810 
    811 typedefRedef-ERR1: typedefRedef.cfa $(CFACC)
    812         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    813 
    814 alloc-ERROR: alloc.cfa $(CFACC)
    815         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    816 
    817 fallthrough-ERROR: fallthrough.cfa $(CFACC)
    818         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    819 
    820 nested-types-ERR1: nested-types.cfa $(CFACC)
    821         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    822 
    823 nested-types-ERR2: nested-types.cfa $(CFACC)
    824         $(PRETTY_PATH) $(CFACOMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    825 
    826 # Constructor/destructor tests
    827 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC)
    828         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    829 
    830 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC)
    831         $(PRETTY_PATH) $(CFACOMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    832 
    833 raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC)
    834         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    835 
    836 raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC)
    837         $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     833        $(CFATEST_STDERR) -fsyntax-only
    838834
    839835# Warnings
    840836warnings/self-assignment: warnings/self-assignment.cfa $(CFACC)
    841         $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only
     837        $(CFATEST_STDERR) -fsyntax-only
    842838
    843839# Tell versions [3.59,3.63) of GNU make to not export all variables.
Note: See TracChangeset for help on using the changeset viewer.