diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 59b65922bf7ede233b9f60ef4e95c431b02a41f7..96af38be130b31216a86e354573da8df784f90b7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -76,6 +76,7 @@ stages: - cp -r build/.sac2crc $HOME - cd build - make fulltest + - ctest --output-on-failure artifacts: expire_in: 12 hrs untracked: true diff --git a/cmake/cpack/CMakeLists.txt b/cmake/cpack/CMakeLists.txt index 8d0f82694c1fb8486a38ce8473736ee991d1f5f3..2472fc3b48bc6b624e7528bb33f18729a88b257e 100644 --- a/cmake/cpack/CMakeLists.txt +++ b/cmake/cpack/CMakeLists.txt @@ -77,7 +77,7 @@ MACRO (ADD_SAC2C_BUILD _build_type) COMMAND $(MAKE) DESTDIR=${PROJECT_BINARY_DIR}/toplevel/headers headers-install COMMAND $(MAKE) DESTDIR=${PROJECT_BINARY_DIR}/toplevel/symlinks symlinks-install TEST_EXCLUDE_FROM_MAIN 1 - TEST_COMMAND ctest + TEST_COMMAND ctest --output-on-failure BUILD_ALWAYS 1 CMAKE_ARGS -DCMAKE_BUILD_TYPE=${_build_type} diff --git a/cmake/sac2c/config.cmake b/cmake/sac2c/config.cmake index 633b769088aaa2f41656ce267297e97ce726632c..299437095d7f54d6eb0e1873c5358e2e9b7ccd01 100644 --- a/cmake/sac2c/config.cmake +++ b/cmake/sac2c/config.cmake @@ -167,24 +167,45 @@ LIB_NEEDED ("m" "pow" " # Check libraries for optional isl support SET (ISL_LIB_PATH "") SET (ENABLE_ISL OFF) -IF (ISL) +MESSAGE(STATUS "ISL setting is ${ISL}") +IF (${ISL} MATCHES "ON") + MESSAGE(STATUS "ISL was set to ON") FIND_LIBRARY (LIB_ISL NAMES "isl") CHECK_INCLUDE_FILES ("isl/ctx.h" HAVE_ISL_H) IF (LIB_ISL AND HAVE_ISL_H) FIND_PATH (ISL_INC_PATH NAMES "isl/ctx.h") SET (ENABLE_ISL ON) + MESSAGE(STATUS "ISL include library found") + ELSE () + MESSAGE(STATUS "ISL include library NOT found") + ENDIF () +ELSE () + IF (${ISL} MATCHES "OFF") + MESSAGE(STATUS "ISL was set to OFF") + ELSE () + MESSAGE(FATAL_ERROR "ISL setting not valid; was: " ${ISL}) ENDIF () ENDIF () # Check libraries for optional barvinok support SET (BARVINOK_LIB_PATH "") SET (ENABLE_BARVINOK OFF) -IF (BARVINOK) +MESSAGE(STATUS "BARVINOK setting is ${BARVINOK}") +IF (${BARVINOK} MATCHES "ON") FIND_LIBRARY (LIB_BARVINOK NAMES "barvinok") CHECK_INCLUDE_FILES ("barvinok/barvinok.h" HAVE_BARVINOK_H) IF (LIB_BARVINOK AND HAVE_BARVINOK_H) FIND_PATH (BARVINOK_INC_PATH NAMES "barvinok/barvinok.h") SET (ENABLE_BARVINOK ON) + MESSAGE(STATUS "BARVINOK include library found") + ELSE () + MESSAGE(STATUS "BARVINOK include library NOT found") + ENDIF () +ELSE () + IF (${BARVINOK} MATCHES "OFF") + MESSAGE(STATUS "BARVINOK was set to OFF") + ELSE () + MESSAGE(FATAL_ERROR "BARVINOK setting not valid; was: " ${BARVINOK}) ENDIF () ENDIF () @@ -848,14 +869,18 @@ SET (BUILD_STATUS " * * Run-time specialization: ${ENABLE_RTSPEC} * Private heap manager: ${PHM} -* Back-ends: +* Polyhedral optional packages: +* - ISL: ${ENABLE_ISL} +* - BARVINOK: ${ENABLE_BARVINOK} +* Back ends: * - MT/pthread: ${ENABLE_MT} * - MT/LPEL: ${ENABLE_MT_LPEL} * - CUDA: ${ENABLE_CUDA} * - OpenMP: ${ENABLE_OMP} * - SL: ${ENABLE_SL} * - HWLOC: ${ENABLE_HWLOC} -* - Distributed memory: ${ENABLE_DISTMEM}$distmem_details_print +* - Distributed memory: ${ENABLE_DISTMEM} +* ${distmem_details_print} * ====== distmen is non-functional ====== * - CC: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID}) * - CCFLAGS: ${BUILD_TYPE_C_FLAGS} @@ -864,7 +889,7 @@ SET (BUILD_STATUS " * - SaC Linksetsize: ${LINKSETSIZE} * * Status: -* - sac2c is in dirty state: ${SAC2C_IS_DIRTY} +* - sac2c dirty state is: ${SAC2C_IS_DIRTY} *") STRING (REPLACE "\n" "\\n\\\n" CPP_BUILD_STATUS ${BUILD_STATUS}) diff --git a/src/libsac2c/arrayopt/isl_utilities.c b/src/libsac2c/arrayopt/isl_utilities.c index 9e085fd4a9c179268d6c929776fd51b57c25638f..9ef160b437ed89137fa03fcd8ec97d8a6aa91c22 100644 --- a/src/libsac2c/arrayopt/isl_utilities.c +++ b/src/libsac2c/arrayopt/isl_utilities.c @@ -221,7 +221,8 @@ ISLUgetLoopCount (char *str, lut_t *varlut) dim = isl_union_pw_qpolynomial_get_space (pwcard); zro = isl_point_zero (isl_space_copy (dim)); val = isl_union_pw_qpolynomial_eval (pwcard, zro); - z = (NULL != val) ? isl_val_get_num_si (val) : z; + z = ((NULL != val) && (isl_val_is_rat (val))) + ? isl_val_get_num_si (val) : z; z = (0 == z) ? UNR_NONE : z; isl_val_free (val); isl_space_free (dim); diff --git a/src/libsac2c/arrayopt/polyhedral_utilities.c b/src/libsac2c/arrayopt/polyhedral_utilities.c index a8bed45fccec15c82d511c9d6a7712ecc7072306..6f03ea8ee81684642977bba861baabd3815bc472 100644 --- a/src/libsac2c/arrayopt/polyhedral_utilities.c +++ b/src/libsac2c/arrayopt/polyhedral_utilities.c @@ -2851,6 +2851,7 @@ PHUTanalyzeLoopDependentVariable (node *vid, node *rcv, node *fundef, lut_t *var prf prfiv; prf prfz; int stridesignum = 0; // -1 for negative, 1 for positive, 0 for unknown or 0. + int lpcount = UNR_NONE; DBUG_ENTER (); @@ -2897,8 +2898,9 @@ PHUTanalyzeLoopDependentVariable (node *vid, node *rcv, node *fundef, lut_t *var TYmakeAKS (TYmakeSimpleType (T_int), SHcreateShape (0))); PHUTinsertVarIntoLut (lpavis, varlut, fundef, AVIS_ISLCLASSEXISTENTIAL); // If this is a loopfun with known loopcount, use it. - if ((FUNDEF_ISLOOPFUN (fundef)) && (UNR_NONE != loopcount)) { - resel = BuildIslSimpleConstraint (lpavis, F_lt_SxS, TBmakeNum (loopcount), + lpcount = FUNDEF_LOOPCOUNT (fundef); + if ((FUNDEF_ISLOOPFUN (fundef)) && (UNR_NONE != lpcount)) { + resel = BuildIslSimpleConstraint (lpavis, F_lt_SxS, TBmakeNum (lpcount), NOPRFOP, NULL); res = TCappendExprs (res, resel); } diff --git a/src/libsac2c/arrayopt/polyhedral_wlf.c b/src/libsac2c/arrayopt/polyhedral_wlf.c index 4b63c63903b62a39e599c6fc2e94e25cc7e83d7c..5528dc0bd284792cdb0bc4e8335ba221f25d9080 100644 --- a/src/libsac2c/arrayopt/polyhedral_wlf.c +++ b/src/libsac2c/arrayopt/polyhedral_wlf.c @@ -1654,6 +1654,8 @@ PWLFprf (node *arg_node, info *arg_info) AVIS_NAME (ID_AVIS (pwlid)), cwlnm, plresult); DBUG_PRINT ("Building inverse projection for cwl=%s", cwlnm); arg_node = BuildInverseProjections (arg_node, arg_info); + DBUG_ASSERT (POLY_RET_CCONTAINSB == plresult, + "Coding time, Bobbo. We need to slice cwl"); z = PWLFperformFold (arg_node, foldpwlpart, arg_info); FREEdoFreeNode (arg_node); arg_node = z; diff --git a/src/tools/sacislinterface/sacislinterface.c b/src/tools/sacislinterface/sacislinterface.c index 9bdc9e10d06eac66cf5ef151f479020b80be09cb..6868a1c2b2394f822e02adc15fd294982dfea6db 100644 --- a/src/tools/sacislinterface/sacislinterface.c +++ b/src/tools/sacislinterface/sacislinterface.c @@ -41,24 +41,6 @@ printBasicSet (struct isl_basic_set *pset, char *titl) return; } -#ifdef DEADCODE -// This from Roman Gareev, isl-development google group -// 2014-03-08. - -static __isl_give isl_ast_build * -set_options (__isl_take isl_ast_build *control, __isl_keep isl_union_map *schedule) -{ - isl_ctx *ctx = isl_union_map_get_ctx (schedule); - isl_space *range_space = isl_space_set_alloc (ctx, 0, 1); - range_space = isl_space_set_tuple_name (range_space, isl_dim_set, "separate"); - isl_union_set *range = isl_union_set_from_set (isl_set_universe (range_space)); - isl_union_set *domain = isl_union_map_range (isl_union_map_copy (schedule)); - domain = isl_union_set_universe (domain); - isl_union_map *options = isl_union_map_from_domain_and_range (domain, range); - return isl_ast_build_set_options (control, options); -} -#endif // DEADCODE - void printSchedule (FILE *fd, isl_schedule *sched, char *titl, int verbose, int fmt) { @@ -520,7 +502,8 @@ ISLUgetLoopCount (__isl_keep isl_union_set *dom, int verbose) dim = isl_union_pw_qpolynomial_get_space (pwcard); zro = isl_point_zero (isl_space_copy (dim)); val = isl_union_pw_qpolynomial_eval (pwcard, zro); - z = (NULL != val) ? isl_val_get_num_si (val) : z; + z = ((NULL != val) && (isl_val_is_rat (val))) + ? isl_val_get_num_si (val) : z; z = (0 == z) ? UNR_NONE : z; isl_val_free (val); isl_space_free (dim); @@ -641,8 +624,8 @@ main (int argc, char *argv[]) default: fprintf (stderr, "caller is confused. We got opcode=%c\n", opcode); - // break elision is intentional - /* Falls through. */ + break; + case POLY_OPCODE_HELP: case POLY_OPCODE_HELPLC: fprintf (stderr, "legal opcodes are %c, %c, %c, %c, %c\n", POLY_OPCODE_INTERSECT, diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f19f5521483ea330ba37144a4d1378370c777811..69deceab97de9b42133aca40ecb535c1c0d5b1d8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -10,7 +10,8 @@ MACRO (REGISTER_TEST sac_file) ENDMACRO () SET (SAC2C_EXEC "${PROJECT_BINARY_DIR}/sac2c${BUILD_TYPE_POSTFIX}") -SET (SCRIPT_LIST common.sh run.sh grep-command-output.sh check-return-status.sh) +SET (SCRIPT_LIST common.sh run.sh grep-command-output.sh +check-return-status.sh isalloptionson.sh) FOREACH (script ${SCRIPT_LIST}) CONFIGURE_FILE( @@ -21,6 +22,14 @@ CONFIGURE_FILE ( "${PROJECT_SOURCE_DIR}/tests/common.mk.in" "${PROJECT_BINARY_DIR}/tests/common.mk" @ONLY) +CONFIGURE_FILE ( + "${PROJECT_SOURCE_DIR}/tests/ut-optional-packages.h.in" + "${PROJECT_BINARY_DIR}/tests/ut-optional-packages.h" COPYONLY) +CONFIGURE_FILE ( + "${PROJECT_SOURCE_DIR}/tests/ut-flags.mk.in" + "${PROJECT_BINARY_DIR}/tests/ut-flags.mk" COPYONLY) + + FILE (GLOB sac_test_files "${PROJECT_SOURCE_DIR}/tests/*.sac") #FILE (GLOB scripts "${PROJECT_SOURCE_DIR}/tests/*.sh") FILE (GLOB mk "${PROJECT_SOURCE_DIR}/tests/*.mk") diff --git a/tests/README.md b/tests/README.md index 9b4e96fda0be7b6c93a8bd0f0a2fd80144be37c1..14fb861c22ebc3dc8536d523eb4d597553a747a6 100644 --- a/tests/README.md +++ b/tests/README.md @@ -3,7 +3,7 @@ Unittests for sac2c The unit tests in this directory are supposed to ensure correct operation of a specific functionality of `sac2c`. Each unit test in its code encodes how -it should be run and what are criteria for pass. +it should be run and what are its criteria for success. The encoding is done using a series of line comments that start with a tag `// SAC_TEST|` from the first column of any line. `// SAC_TEST|...` lines @@ -33,7 +33,8 @@ Meta tags section below. ## Running unit tests -Running unit tests is acheived via +Running unit tests is achieved via + ```sh make test ``` @@ -43,9 +44,9 @@ can become important if the number of tests increases, use ctests -j5 ``` -For each test cmake generates a call to a script +For each test, cmake generates a call to a script `/tests/scripts/run.sh `. For debugging -purposes this process can be done manually: +purposes, this process can be done manually: ``` cd build/tests ./scripts/run.sh test-trivial.sac @@ -72,7 +73,7 @@ are often used. It is very likely that every unit test should start with ``` // SAC_TEST|include common.mk ``` -definiton. Further, common functionality that is relevant to a set of unit +definition. Further, common functionality that is relevant to a set of unit tests can be abstracted in the header files and sed via includes. For example: ```sh @@ -101,7 +102,7 @@ The following variables are defined: `SAC2C_FLAGS`, `GREP_COMMAND_OUTPUT`, `CHECK_RETURN_STATUS` and a generic rule to build sac programs from sac sources. For explanation see comments in `common.mk`. -Two shell scripts are defined in scripts tha are used in `common.mk`: +Several shell scripts are defined in scripts, to be used in `common.mk`: * `check-return-status.sh` --- runs the binary passed as a first argument and checks that its return status is equal to the second argument. @@ -109,6 +110,8 @@ Two shell scripts are defined in scripts tha are used in `common.mk`: * `grep-command-output.sh` --- a wrapper around grep that counts the number of occurrences of the first argument is equal to the second argument. + * `runttest: + ## Meta tags diff --git a/tests/common.mk.in b/tests/common.mk.in index bbfc3aaa7783af35f93480a518bb404a69099df2..b5bc1a0ec72c996e7013c38c822e55993419ad29 100644 --- a/tests/common.mk.in +++ b/tests/common.mk.in @@ -1,17 +1,18 @@ SAC2C := @SAC2C_EXEC@ SAC2C_FLAGS := -v0 -# Name wrapper around the shell script that takes two arguments -# `what' and `num' and verifies that $what is found $num times +# Name wrapper around shell script taking two arguments +# specifying a grep string and wc for same # on the stdout. GREP_COMMAND_OUTPUT := ./scripts/grep-command-output.sh +# Namewrapper for predicate script that returns true if +# all sac2c optional packages are enabled +ISALLOPTIONSON := ./scripts/isalloptionson.sh # Namewrapper for a script of two arguments `binary' and `ret' # that verifies that return status of executing $binary is $ret. CHECK_RETURN_STATUS := ./scripts/check-return-status.sh - %:%.sac $(SAC2C) $(SAC2C_FLAGS) -o $@ $< - diff --git a/tests/mini-stdlib.sac b/tests/mini-stdlib.sac index f8195507fdfcc36e9d295e09a5bd769be7829730..593b11e468f9c105ecf09cf3dae86c1d6bb7eed4 100644 --- a/tests/mini-stdlib.sac +++ b/tests/mini-stdlib.sac @@ -7,20 +7,57 @@ inline int + (int a, int b) { return _add_SxS_ (a, b); } inline int - (int a, int b) { return _sub_SxS_ (a, b); } inline int * (int a, int b) { return _mul_SxS_ (a, b); } inline int / (int a, int b) { return _div_SxS_ (a, b); } +inline int - (int b) { return _sub_SxS_ (0, b); } -// Logical operationns + +// Logical operations inline bool < (int a, int b) { return _lt_SxS_ (a, b); } inline bool <= (int a, int b) { return _le_SxS_ (a, b); } inline bool > (int a, int b) { return _gt_SxS_ (a, b); } inline bool >= (int a, int b) { return _ge_SxS_ (a, b); } inline bool == (int a, int b) { return _eq_SxS_ (a, b); } inline bool != (int a, int b) { return _neq_SxS_ (a, b); } +inline bool != (bool a, bool b) { return _neq_SxS_ (a, b); } + + +// Selection functions +inline int[*] sel(int[.] idx, int[*] array) +{ + new_shape = _drop_SxV_ (_sel_VxA_ ([0], _shape_A_ (idx)), + _shape_A_ (array)); + return with { + (. <= iv <= .) { + new_idx = _cat_VxV_ (idx, iv); + } : _sel_VxA_ (new_idx, array); + } : genarray (new_shape, 0); +} + +inline int[*] sel (int idx, int[*] a) +{ + return sel ([idx], a); +} + +inline bool[*] sel (int[.] idx, bool[*] array) +{ + new_shape = _drop_SxV_ (_sel_VxA_ ([0], _shape_A_ (idx)), + _shape_A_ (array)); + return with { + (. <= iv <= .) { + new_idx = _cat_VxV_ (idx, iv); + } : _sel_VxA_ (new_idx, array); + } : genarray (new_shape, false); +} -// Selection -inline int sel (int[.] iv, int[*] a) { return _sel_VxA_ (iv, a); } // Shape +inline int[.] shape (bool[*] a) { return _shape_A_ (a); } +inline int dim (bool[*] a) { return _dim_A_ (a); } inline int[.] shape (int[*] a) { return _shape_A_ (a); } +inline int dim (int[*] a) { return _dim_A_ (a); } + +// Scalar-vector take/drop +inline int[.] take (int a, int[.] b) { return _take_SxV_ (a,b); } +inline int[.] drop (int a, int[.] b) { return _drop_SxV_ (a,b); } // Increment inline int ++ (int a) { return _add_SxS_ (a, 1); } @@ -42,11 +79,51 @@ inline int[.] / (int a, int[.] b) { return _div_SxV_ (a, b); } inline int[.] / (int[.] b, int a) { return _div_VxS_ (b, a); } inline int[.] / (int[.] a, int[.] b) { return _div_VxV_ (a, b); } +// Reshape +inline int[*] reshape (int[.] a, int[*] b) { return _reshape_VxA_(a,b); } +inline bool[*] reshape (int[.] a, bool[*] b) { return _reshape_VxA_(a,b); } -inline int sum (int[*] a) +// Integer utilities +inline int[.] iota (int a) +{ + return with { + (. <= iv=[k] <= .) : k; + }: genarray ([a], 0); +} + +// Reductions +inline int sum (bool[+] a) +{ + sh = shape (a); + return with { + (0*sh <= iv < sh): _toi_S_(a[iv]); + }: fold (+, 0); +} + +inline int sum (int[+] a) { sh = shape (a); return with { (0*sh <= iv < sh): a[iv]; }: fold (+, 0); } + +inline int prod (int[*] a) +{ + sh = shape (a); + return with { + (0*sh <= iv < sh): a[iv]; + }: fold (*, 1); +} + +// Array generation from scalar b +inline int[*] genarray (int[.] shp, int b) +{ + return with {}: genarray (shp, b); +} + +inline bool[*] genarray (int[.] shp, bool b) +{ + return with {}: genarray (shp, b); +} + diff --git a/tests/scripts/check-return-status.sh.in b/tests/scripts/check-return-status.sh.in index d83bf39f8028bdb9bec28e9a87f5ef9ebf9ef624..82388eb814c3d4ec5f59fd2d16179e7978b473a6 100755 --- a/tests/scripts/check-return-status.sh.in +++ b/tests/scripts/check-return-status.sh.in @@ -2,13 +2,15 @@ source $(dirname $0)/common.sh -# We check the return status of this binary: +# We check the return status of binary: +# arguments are: binary, desired return status +# binary=$1 - # The return status should be this value: ret=$2 ./$binary -if test $? -ne $ret; then - die "'$binary' expected to return $ret as exit code" +exit_status=$? +if test $exit_status -ne $ret; then + die "'$binary' expected $ret as exit_status, but got $exit_status" fi diff --git a/tests/scripts/grep-command-output.sh.in b/tests/scripts/grep-command-output.sh.in index 7f0ffd7ad3d8091503166f8a01a56176d437c3bc..cd1828e5e695d3e55e0b02479e6b8721de7e3e4e 100755 --- a/tests/scripts/grep-command-output.sh.in +++ b/tests/scripts/grep-command-output.sh.in @@ -2,15 +2,15 @@ source $(dirname $0)/common.sh -# What are we grepping for +# What we are grepping for what=$1 # How many times should it be there num=$2 -# We assume that we read output from stdin +# We read output from stdin count=$(grep "$what" | wc -l) -if test $count -ne $num; then +if [ $count -ne $num ]; then die "expected to find $num instances of '$what', found $count instead" fi diff --git a/tests/scripts/isalloptionson.sh.in b/tests/scripts/isalloptionson.sh.in new file mode 100755 index 0000000000000000000000000000000000000000..70a7b63e4215b7b50ce0dfb5fe2547a7bab0dff9 --- /dev/null +++ b/tests/scripts/isalloptionson.sh.in @@ -0,0 +1,21 @@ +#!@BASH@ + +# predicate: return true(0) if all script arguments are configured ON in sac2c, +# and print yes/no on stdout. Caller decisions are driven by the stdout value. + +# Arguments are: sac2c name, optionalpackage1, optionalpackage2,... + +sac=$1 +shift + +for i in $@; do + res=$($sac -VV | grep $i:) + res=${res##*:\ } + res=$(echo $res | tr -d '[:space:]') + if [ "$res" != "ON" ]; then + echo "no"; exit 1 + fi +done +# All arguments were configured ON in sac2c + echo "yes"; exit 0 + diff --git a/tests/test-condfun.nostdlib.sac b/tests/test-condfun.nostdlib.sac new file mode 100644 index 0000000000000000000000000000000000000000..6b22261c71ce1b5562e367cd4ed4ffd1c31d23b4 --- /dev/null +++ b/tests/test-condfun.nostdlib.sac @@ -0,0 +1,68 @@ + +#include "ut-flags.mk" +// SAC_TEST|GREP_STR=_val_ +// SAC_TEST|GREP_COUNT=0 +/* + * + * Try to find crc.sac bug that puts -ecc code above if() in + * condfun. + * + * See Bug #1079 to see why this does not work properly. + * + * This test requires that we run with -dolacsi to ensure + * that the guards on the two sel() ops are removed. + * It also requires -ecc or -doawlf. + * + * PWLF note: + * As of sac2c Build #18548 (or earlier), without -doawlf + * (for our purposes, -doivext would suffice, were it an option) + * one guard is not removed, because we need extrema information + * about N within the N_cond. If we want to eliminate the need + * to drag extrema around with us, we might want to make + * PHUT treat LACFUNs better. I.e., make it do interprocedural + * analysis. This might also supplant the need for -dolacsi/-dolacso. + * + * The above PHUT extension should work. + * + */ + +/* RESULT: _val_ 5 0 */ + +int[*] id( int[*] y) +{ + return(y); +} + +bool[*] cond( bool[*]y) +{ + return(y); +} + +inline +int[.] iota( int y) +{ + z = with{ ( . <= iv=[k] <= .) : k; + } : genarray([y],42); + return( z); + +} + + +int main() +{ + N = id( 50); + N = _max_SxS_( N, 50); + XXX = iota( N); + ndx1 = 23; + ndx2 = 4; + + if( cond(true)) { + z = _sel_VxA_( [ _add_SxS_( ndx1, 1)], XXX); + } else { + z = _sel_VxA_( [ _add_SxS_( ndx2, 1)], XXX); + } + + z = _sub_SxS_(z, 24); + return(z); +} + diff --git a/tests/test-ipbbFaux.sac b/tests/test-ipbbFaux.sac new file mode 100644 index 0000000000000000000000000000000000000000..5dceffb81b2181018afd26c510cff9fab18578fa --- /dev/null +++ b/tests/test-ipbbFaux.sac @@ -0,0 +1,52 @@ +// gitlab unit test boilerplate + +#include "ut-flags.mk" +// SAC_TEST|GREP_STR=val_l +// SAC_TEST|GREP_COUNT=0 + +#include "mini-stdlib.sac" + +// ipbb, converted to run under mini-stdlib +// and give entirely different answers... + +/* RESULT: val_l 12 0 */ + +inline +int[+] ordotandBBBSTARLIKE(int[+]x, int[+]y) +{ /* CDC STAR-100 APL Algorithm for inner product */ + rowsx = shape(x)[0]; + colsx = shape(x)[1]; + colsy = shape(y)[1]; + Zrow = genarray([colsy],0); + z = with { + (. <= [row] <= .) { + Crow = Zrow; + for (colx=0; colx ipt[j,i] }; // Transpose + mres = ordotandBBBSTARLIKE(ipt2, ipt); + z = sum(mres); + return(z); +} + +int main() +{ + z = ipbbXII( 10); + z2 = z == 49455; + zz = 1 - _toi_S_(z2); + return(zz); +} + diff --git a/tests/ut-flags.mk.in b/tests/ut-flags.mk.in new file mode 100644 index 0000000000000000000000000000000000000000..2e189c11cf93ba518b326b98b77471f0a99cdd6c --- /dev/null +++ b/tests/ut-flags.mk.in @@ -0,0 +1,28 @@ +// TEMPORARY LOCATION UNTIL ARTEM GETS SUBDIR SUPPORT WORKING. +// THIS IS FOR POGO ONLY... other subdirs need different flags + +// gitlab unit test flag definitions for POGO + +// Caller must define GREP_STR and GREP_COUNT; +// GREP_STR is the string to look for in the compiler output, +// e.g., GREP_STR="val_l" +// GREP_COUNT is the number of occurrences of that string if all goes well, +// e.g., GREP_COUNT=42 +//echo GREP_STR is $GREP_STR and GREP_COUNT is $GREP_COUNT + +// SAC_TEST|include common.mk +// Compile and execute unit test; save exit code +// SAC_TEST|SAC2C_FLAGS += -check c -dopogo -noggs -dolacsi -dowlf -nopwlf -noctz -norelcf -noainl -doplur +// SAC_TEST|SAC2C_BREAKPOINT := $(SAC2C_FLAGS) -bopt:wlbscnf2 -printfun main +// SAC_TEST|CALL_SAC2C := $(SAC2C) $(SAC2C_FLAGS) +// SAC_TEST|ifeq ($(shell ./scripts/isalloptionson.sh $(SAC2C) "ISL" "BARVINOK"),yes) +// SAC_TEST|all: +// SAC_TEST|@$(SAC2C) $(SAC2C_FLAGS) $< -o +// SAC_TEST|$(CHECK_RETURN_STATUS) 0 +// Compile unit test with breakpoint +// SAC_TEST|@$(CALL_SAC2C) $(SAC2C_BREAKPOINT) $< | $(GREP_COMMAND_OUTPUT) $(GREP_STR) $(GREP_COUNT) +// SAC_TEST|else +// SAC_TEST|all: +// SAC_TEST|echo "test skipped. Unsupported sac2c configuration" +// SAC_TEST|endif + diff --git a/tests/ut-optional-packages.h.in b/tests/ut-optional-packages.h.in new file mode 100644 index 0000000000000000000000000000000000000000..f602ac93009e92fa1b4b2456f704971d4de8e18d --- /dev/null +++ b/tests/ut-optional-packages.h.in @@ -0,0 +1,3 @@ +ISL +BARVINOK +