Changeset bee653c


Ignore:
Timestamp:
Mar 28, 2019, 6:35:21 PM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
2fabdc02, 9be2b60
Parents:
8a25be9 (diff), b611fc3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
6 added
6 deleted
6 edited
8 moved

Legend:

Unmodified
Added
Removed
  • configure

    r8a25be9 rbee653c  
    1673816738
    1673916739#==============================================================================
    16740 ac_config_files="$ac_config_files Makefile driver/Makefile src/Makefile benchmark/Makefile tests/Makefile tests/preempt_longrun/Makefile tools/Makefile tools/prettyprinter/Makefile"
     16740ac_config_files="$ac_config_files Makefile driver/Makefile src/Makefile benchmark/Makefile tests/Makefile longrun_tests/Makefile tools/Makefile tools/prettyprinter/Makefile"
    1674116741
    1674216742
     
    1787617876    "benchmark/Makefile") CONFIG_FILES="$CONFIG_FILES benchmark/Makefile" ;;
    1787717877    "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
    17878     "tests/preempt_longrun/Makefile") CONFIG_FILES="$CONFIG_FILES tests/preempt_longrun/Makefile" ;;
     17878    "longrun_tests/Makefile") CONFIG_FILES="$CONFIG_FILES longrun_tests/Makefile" ;;
    1787917879    "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
    1788017880    "tools/prettyprinter/Makefile") CONFIG_FILES="$CONFIG_FILES tools/prettyprinter/Makefile" ;;
  • configure.ac

    r8a25be9 rbee653c  
    211211        benchmark/Makefile
    212212        tests/Makefile
    213         tests/preempt_longrun/Makefile
     213        longrun_tests/Makefile
    214214        tools/Makefile
    215215        tools/prettyprinter/Makefile
  • longrun_tests/Makefile.in

    r8a25be9 rbee653c  
    9191build_triplet = @build@
    9292host_triplet = @host@
    93 subdir = tests/preempt_longrun
     93subdir = longrun_tests
    9494ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    9595am__aclocal_m4_deps = $(top_srcdir)/automake/libtool.m4 \
     
    331331        $(TEST_LOG_FLAGS)
    332332am__DIST_COMMON = $(srcdir)/Makefile.in \
    333         $(top_srcdir)/automake/test-driver
     333        $(top_srcdir)/automake/test-driver $(top_srcdir)/src/cfa.make
    334334DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    335335ACLOCAL = @ACLOCAL@
     
    342342AWK = @AWK@
    343343BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@
    344 CC = @CFACC@
     344CC = @CC@
    345345CCAS = @CCAS@
    346346CCASDEPMODE = @CCASDEPMODE@
     
    356356CFA_NAME = @CFA_NAME@
    357357CFA_PREFIX = @CFA_PREFIX@
    358 CFLAGS = ${BUILD_FLAGS}
     358CFLAGS = @CFLAGS@
    359359CPP = @CPP@
    360360CPPFLAGS = @CPPFLAGS@
     
    479479AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
    480480ACLOCAL_AMFLAGS = -I automake
     481CFACOMPILE = $(CFACC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) $(AM_CFLAGS) $(CFLAGS)
     482LTCFACOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
     483        $(LIBTOOLFLAGS) --mode=compile $(CFACC) $(DEFS) \
     484        $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) \
     485        $(AM_CFLAGS) $(CFLAGS)
     486
     487AM_V_CFA = $(am__v_CFA_@AM_V@)
     488am__v_CFA_ = $(am__v_CFA_@AM_DEFAULT_V@)
     489am__v_CFA_0 = @echo "  CFA     " $@;
     490am__v_CFA_1 =
     491AM_V_JAVAC = $(am__v_JAVAC_@AM_V@)
     492am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@)
     493am__v_JAVAC_0 = @echo "  JAVAC   " $@;
     494am__v_JAVAC_1 =
     495AM_V_GOC = $(am__v_GOC_@AM_V@)
     496am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@)
     497am__v_GOC_0 = @echo "  GOC     " $@;
     498am__v_GOC_1 =
     499UPPCC = u++
     500UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS)
     501AM_V_UPP = $(am__v_UPP_@AM_V@)
     502am__v_UPP_ = $(am__v_UPP_@AM_DEFAULT_V@)
     503am__v_UPP_0 = @echo "  UPP     " $@;
     504am__v_UPP_1 =
    481505repeats = 10
    482506max_time = 600
     
    484508debug = -debug
    485509type = LONG
    486 REPEAT = ${abs_top_srcdir}/tools/repeat
    487 WATCHDOG = ${abs_top_srcdir}/tools/watchdog
     510REPEAT = $(abs_top_builddir)/tools/repeat
     511WATCHDOG = $(abs_top_builddir)/tools/watchdog
    488512TIME = /usr/bin/time -f "%E"
    489 
    490 # $(shell ./update-type $(type))
    491 # ./update-type $(type)
    492 UPDATED_TYPE = $(shell ./update-type $(type))
    493 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} -I.. -I. -DTEST_$(shell cat .type | tr a-z A-Z)
     513UPDATED_TYPE = $(shell $(srcdir)/update-type $(type))
     514BUILD_FLAGS =
     515AM_CFAFLAGS = \
     516        -g \
     517        -Wall \
     518        -Wno-unused-function \
     519        -quiet \
     520        -O2 \
     521        -DPREEMPTION_RATE=$(preempt) \
     522        -I$(abs_top_srcdir)/tests \
     523        -I$(srcdir) \
     524        -DTEST_$(shell cat .type | tr a-z A-Z) \
     525        -in-tree
     526
    494527TESTS = block coroutine create disjoint enter enter3 processor stack wait yield
    495528all: all-am
    496529
    497530.SUFFIXES:
    498 .SUFFIXES: .log .test .test$(EXEEXT) .trs
    499 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(am__configure_deps)
     531.SUFFIXES: .cfa .lo .log .o .test .test$(EXEEXT) .trs
     532$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/src/cfa.make $(am__configure_deps)
    500533        @for dep in $?; do \
    501534          case '$(am__configure_deps)' in \
     
    506539          esac; \
    507540        done; \
    508         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/preempt_longrun/Makefile'; \
     541        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign longrun_tests/Makefile'; \
    509542        $(am__cd) $(top_srcdir) && \
    510           $(AUTOMAKE) --foreign tests/preempt_longrun/Makefile
     543          $(AUTOMAKE) --foreign longrun_tests/Makefile
    511544Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    512545        @case '$?' in \
     
    517550            cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
    518551        esac;
     552$(top_srcdir)/src/cfa.make $(am__empty):
    519553
    520554$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
     
    917951
    918952
    919 # .INTERMEDIATE: ${TESTS}
    920 
    921 all-local: ${TESTS:=.run}
    922 
    923 runall : ${TESTS:=.run}
     953.cfa.o:
     954        $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
     955        $(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     956        $(am__mv) $$depbase.Tpo $$depbase.Po
     957
     958.cfa.lo:
     959        $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
     960        $(LTCFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     961        $(am__mv) $$depbase.Tpo $$depbase.Plo
     962
     963# .INTERMEDIATE: $(TESTS)
     964
     965all-local: $(TESTS:=.run)
     966
     967runall : $(TESTS:=.run)
    924968        @ echo "All programs terminated normally"
    925969
    926 watchall : ${TESTS:=.watch}
     970watchall : $(TESTS:=.watch)
    927971        @ echo "All programs terminated normally"
    928972
    929 compileall : ${TESTS}
     973compileall : $(TESTS)
    930974        @ echo "Compiled"
    931975
    932976clean-local:
    933         rm -f ${TESTS} core* out.log .type
    934 
    935 % : %.c ${CC} ${UPDATED_TYPE}
    936         ${AM_V_GEN}${CC} ${CFLAGS} ${<} $(debug) -o ${@}
    937 
    938 %.run : % ${REPEAT}
    939         @ time ${REPEAT} -r out.log -i -s $(repeats) timeout ${max_time} ./${<}
    940         @ rm ${<}
    941         @ echo -e "${<}: SUCCESS\n"
    942 
    943 %.watch : % ${WATCHDOG}
    944         @ time ${WATCHDOG} ./${<}
    945         @ rm ${<}
    946         @ echo -e "${<}: SUCCESS\n"
    947 
    948 %.time : % ${REPEAT}
    949         @ ${REPEAT} -i -s -- $(repeats) $(TIME) -a -o times.log ./${<}
    950         @ rm ${<}
    951         @ echo -e "${<}: SUCCESS\n"
    952 
    953 ${REPEAT}: ${abs_top_srcdir}/tools/Makefile
    954         @+make -C ${abs_top_srcdir}/tools/
    955 
    956 ${WATCHDOG}: ${abs_top_srcdir}/tools/Makefile
    957         @+make -C ${abs_top_srcdir}/tools/
     977        rm -f $(TESTS) core* out.log .type
     978
     979% : %.cfa $(CFACC) $(UPDATED_TYPE)
     980        $(AM_V_CFA)$(CFACOMPILE) $(<) $(debug) -o $(@)
     981
     982%.run : % $(REPEAT)
     983        @ time $(REPEAT) -r out.log -i -s $(repeats) timeout $(max_time) ./$(<)
     984        @ rm $(<)
     985        @ echo -e "$(<): SUCCESS\n"
     986
     987%.watch : % $(WATCHDOG)
     988        @ time $(WATCHDOG} ./$(<)
     989        @ rm $(<)
     990        @ echo -e "$(<): SUCCESS\n"
     991
     992%.time : % $(REPEAT)
     993        @ $(REPEAT) -i -s -- $(repeats) $(TIME) -a -o times.log ./$(<)
     994        @ rm $(<)
     995        @ echo -e "$(<): SUCCESS\n"
     996
     997$(REPEAT): $(abs_top_builddir)/tools/Makefile
     998        @+make -C $(abs_top_builddir)/tools/
     999
     1000$(WATCHDOG): $(abs_top_builddir)/tools/Makefile
     1001        @+make -C $(abs_top_builddir)/tools/
    9581002
    9591003# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • longrun_tests/enter.cfa

    r8a25be9 rbee653c  
    55
    66#define __kick_rate 75000ul
    7 #include "long_tests.h"
     7#include "long_tests.hfa"
    88
    99#ifndef PREEMPTION_RATE
  • longrun_tests/stack.cfa

    r8a25be9 rbee653c  
    55
    66#define __kick_rate 5000000ul
    7 #include "long_tests.h"
     7#include "long_tests.hfa"
    88
    99#ifndef PREEMPTION_RATE
  • tests/Makefile.am

    r8a25be9 rbee653c  
    3636        -Wno-unused-function \
    3737        -quiet @CFA_FLAGS@ \
    38         -DIN_DIR="${srcdir}/.in/"
     38        -DIN_DIR="${abs_srcdir}/.in/"
    3939
    4040AM_CFLAGS += ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}
  • tests/Makefile.in

    r8a25be9 rbee653c  
    382382# applies to both programs
    383383AM_CFLAGS = $(if $(test), 2> $(test), ) -g -Wall -Wno-unused-function \
    384         -quiet @CFA_FLAGS@ -DIN_DIR="${srcdir}/.in/" ${DEBUG_FLAGS} \
    385         ${INSTALL_FLAGS} ${ARCH_FLAGS}
     384        -quiet @CFA_FLAGS@ -DIN_DIR="${abs_srcdir}/.in/" \
     385        ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}
    386386PRETTY_PATH = 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
  • tests/pybin/tools.py

    r8a25be9 rbee653c  
    1111import subprocess
    1212import sys
     13import tempfile
    1314import time
    1415import types
    1516
    1617from pybin import settings
    17 from subprocess import Popen, PIPE, STDOUT
    1818
    1919################################################################################
     
    2727        # if this is a dry_run, only print the commands that would be ran
    2828        if settings.dry_run :
    29                 print("cmd: %s" % ' '.join(cmd))
     29                cmd = "{} cmd: {}".format(os.getcwd(), ' '.join(cmd))
     30                if output and not isinstance(output, int):
     31                        cmd += " > "
     32                        cmd += output
     33
     34                if error and not isinstance(error, int):
     35                        cmd += " 2> "
     36                        cmd += error
     37
     38                if input and not isinstance(input, int) and os.path.isfile(input):
     39                        cmd += " < "
     40                        cmd += input
     41
     42                print(cmd)
    3043                return 0, None
    3144
    3245        with contextlib.ExitStack() as onexit:
    3346                # add input redirection if needed
    34                 if input and input != subprocess.DEVNULL:
    35                         if os.path.isfile(input):
    36                                 input = open(input)
    37                                 onexit.push(input)
    38                         else:
    39                                 input = None
     47                input = openfd(input, 'r', onexit, True)
    4048
    4149                # add output redirection if needed
    42                 if output and output != subprocess.DEVNULL and output != subprocess.PIPE:
    43                         output = open(output, 'w')
    44                         onexit.push(output)
     50                output = openfd(output, 'w', onexit, False)
     51
     52                # add error redirection if needed
     53                error = openfd(error, 'w', onexit, False)
    4554
    4655                # run the desired command
     
    5059                                stdin =input,
    5160                                stdout=output,
    52                                 stderr=STDOUT,
     61                                stderr=error,
    5362                                timeout=settings.timeout.single if timeout else None
    5463                        )
     
    7887def is_exe(fname):
    7988        return os.path.isfile(fname) and os.access(fname, os.X_OK)
     89
     90def openfd(file, mode, exitstack, checkfile):
     91        if not file:
     92                return file
     93
     94        if isinstance(file, int):
     95                return file
     96
     97        if checkfile and not os.path.isfile(file):
     98                return None
     99
     100        file = open(file, mode)
     101        exitstack.push(file)
     102        return file
    80103
    81104# Remove 1 or more files silently
     
    146169    return None
    147170
     171@contextlib.contextmanager
     172def tempdir():
     173        cwd = os.getcwd()
     174        with tempfile.TemporaryDirectory() as temp:
     175                os.chdir(temp)
     176                try:
     177                        yield temp
     178                finally:
     179                        os.chdir(cwd)
     180
    148181################################################################################
    149182#               file handling
     
    246279
    247280def core_info(path):
     281        if not os.path.isfile(path):
     282                return 1, "ERR Executable path is wrong"
     283
    248284        cmd   = os.path.join(settings.SRCDIR, "pybin/print-core.gdb")
    249285        if not os.path.isfile(cmd):
    250286                return 1, "ERR Printing format for core dumps not found"
    251287
    252         dname = os.path.dirname(path)
    253         core  = os.path.join(dname, "core" )
    254         if not os.path.isfile(path):
    255                 return 1, "ERR Executable path is wrong"
     288        core  = os.path.join(os.getcwd(), "core" )
    256289
    257290        if not os.path.isfile(core):
  • tests/test.py

    r8a25be9 rbee653c  
    88import re
    99import sys
     10import tempfile
    1011import time
    1112
     
    143144                make_ret, _ = make( test.target(), output=subprocess.DEVNULL, error=out_file, error_file = err_file )
    144145
    145         # if the make command succeds continue otherwise skip to diff
    146146        run_dur = None
    147         if success(make_ret):
    148                 with Timed() as run_dur:
    149                         if settings.dry_run or is_exe(exe_file):
    150                                 # run test
    151                                 retcode, _ = sh(exe_file, output=out_file, input=in_file, timeout=True)
     147        # run everything in a temp directory to make sure core file are handled properly
     148        with tempdir():
     149                # if the make command succeds continue otherwise skip to diff
     150                if success(make_ret):
     151                        with Timed() as run_dur:
     152                                if settings.dry_run or is_exe(exe_file):
     153                                        # run test
     154                                        retcode, _ = sh(exe_file, output=out_file, input=in_file, timeout=True)
     155                                else :
     156                                        # simply cat the result into the output
     157                                        retcode = cat(exe_file, out_file)
     158                else:
     159                        retcode = mv(err_file, out_file)
     160
     161                if success(retcode):
     162                        if settings.generating :
     163                                # if we are ounly generating the output we still need to check that the test actually exists
     164                                if no_rule(out_file, test.target()) :
     165                                        retcode = 1
     166                                        error = "\t\tNo make target for test %s!" % test.target()
     167                                        rm(out_file)
     168                                else:
     169                                        error = None
    152170                        else :
    153                                 # simply cat the result into the output
    154                                 retcode = cat(exe_file, out_file)
    155         else:
    156                 retcode = mv(err_file, out_file)
    157 
    158         if success(retcode):
    159                 if settings.generating :
    160                         # if we are ounly generating the output we still need to check that the test actually exists
    161                         if no_rule(out_file, test.target()) :
    162                                 retcode = 1
    163                                 error = "\t\tNo make target for test %s!" % test.target()
    164                                 rm(out_file)
    165                         else:
    166                                 error = None
    167                 else :
    168                         # fetch return code and error from the diff command
    169                         retcode, error = diff(cmp_file, out_file)
    170 
    171         else:
    172                 with open (out_file, "r") as myfile:
    173                         error = myfile.read()
    174 
    175                 ret, info = core_info(exe_file)
    176                 error = error + info if error else info
     171                                # fetch return code and error from the diff command
     172                                retcode, error = diff(cmp_file, out_file)
     173
     174                else:
     175                        with open (out_file, "r") as myfile:
     176                                error = myfile.read()
     177
     178                        ret, info = core_info(exe_file)
     179                        error = error + info if error else info
    177180
    178181
Note: See TracChangeset for help on using the changeset viewer.