added some error check scripts
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
hyung-hwan 2023-11-27 00:08:59 +09:00
parent 3d47a99cd2
commit e91dde6213
8 changed files with 97 additions and 17 deletions

View File

@ -423,7 +423,7 @@ static hcl_oop_t execute_in_batch_mode (hcl_t* hcl, int verbose)
hcl_oop_t retv; hcl_oop_t retv;
hcl_decode (hcl, 0, hcl_getbclen(hcl)); hcl_decode (hcl, 0, hcl_getbclen(hcl));
HCL_LOG2 (hcl, HCL_LOG_MNEMONIC, "BYTECODES bclen = > %zu lflen => %zu\n", hcl_getbclen(hcl), hcl_getlflen(hcl)); HCL_LOG3 (hcl, HCL_LOG_MNEMONIC, "BYTECODES bclen=%zu lflen=%zu ngtmprs=%zu\n", hcl_getbclen(hcl), hcl_getlflen(hcl), hcl_getngtmprs(hcl));
g_hcl = hcl; g_hcl = hcl;
/*setup_tick ();*/ /*setup_tick ();*/

View File

@ -859,6 +859,14 @@ typedef struct hcl_t hcl_t;
# define HCL_UNUSED # define HCL_UNUSED
#endif #endif
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
# define HCL_NORETURN noreturn
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
# define HCL_NORETURN _Noreturn
#else
# define HCL_NORETURN
#endif
/** /**
* The HCL_TYPE_IS_SIGNED() macro determines if a type is signed. * The HCL_TYPE_IS_SIGNED() macro determines if a type is signed.
* \code * \code
@ -1077,7 +1085,9 @@ typedef struct hcl_t hcl_t;
#define HCL_STATIC_JOIN_INNER(x, y) x ## y #define HCL_STATIC_JOIN_INNER(x, y) x ## y
#define HCL_STATIC_JOIN(x, y) HCL_STATIC_JOIN_INNER(x, y) #define HCL_STATIC_JOIN(x, y) HCL_STATIC_JOIN_INNER(x, y)
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
# define HCL_STATIC_ASSERT(expr) static_assert (expr, "invalid assertion")
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
# define HCL_STATIC_ASSERT(expr) _Static_assert (expr, "invalid assertion") # define HCL_STATIC_ASSERT(expr) _Static_assert (expr, "invalid assertion")
#elif defined(__cplusplus) && (__cplusplus >= 201103L) #elif defined(__cplusplus) && (__cplusplus >= 201103L)
# define HCL_STATIC_ASSERT(expr) static_assert (expr, "invalid assertion") # define HCL_STATIC_ASSERT(expr) static_assert (expr, "invalid assertion")

View File

@ -2369,12 +2369,14 @@ HCL_EXPORT int hcl_decode (
); );
#if defined(HCL_HAVE_INLINE) #if defined(HCL_HAVE_INLINE)
static HCL_INLINE hcl_oow_t hcl_getbclen (hcl_t* hcl) { return hcl->code.bc.len; } static HCL_INLINE hcl_oow_t hcl_getbclen (hcl_t* hcl) { return hcl->code.bc.len; }
static HCL_INLINE hcl_oow_t hcl_getlflen (hcl_t* hcl) { return hcl->code.lit.len; } static HCL_INLINE hcl_oow_t hcl_getlflen (hcl_t* hcl) { return hcl->code.lit.len; }
static HCL_INLINE hcl_ooi_t hcl_getip (hcl_t* hcl) { return hcl->ip; } static HCL_INLINE hcl_oow_t hcl_getngtmprs (hcl_t* hcl) { return hcl->code.ngtmprs; }
static HCL_INLINE hcl_ooi_t hcl_getip (hcl_t* hcl) { return hcl->ip; }
#else #else
# define hcl_getbclen(hcl) ((hcl)->code.bc.len) # define hcl_getbclen(hcl) ((hcl)->code.bc.len)
# define hcl_getlflen(hcl) ((hcl)->code.lit.len) # define hcl_getlflen(hcl) ((hcl)->code.lit.len)
# define hcl_getngtmprs(hcl) ((hcl)->code.ngtmprs)
# define hcl_getip(hcl) ((hcl)->ip) # define hcl_getip(hcl) ((hcl)->ip)
#endif #endif

View File

@ -6,17 +6,23 @@ check_SCRIPTS = \
insta-02.hcl \ insta-02.hcl \
ret-01.hcl \ ret-01.hcl \
retvar-01.hcl \ retvar-01.hcl \
va-01.hcl \ va-01.hcl
var-01.hcl
check_ERRORS = \
var-01.err \
var-02.err
##noinst_SCRIPTS = $(check_SCRIPTS) ##noinst_SCRIPTS = $(check_SCRIPTS)
EXTRA_DIST = $(check_SCRIPTS) EXTRA_DIST = $(check_SCRIPTS) $(check_ERRORS)
check_PROGRAMS = check_PROGRAMS =
TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(check_ERRORS)
TESTS = $(check_PROGRAMS) $(check_SCRIPTS) TEST_EXTENSIONS = .hcl .err
TEST_EXTENSIONS = .hcl
HCL_LOG_COMPILER = sh $(abs_srcdir)/run.sh ../bin/hcl -x HCL_LOG_COMPILER = sh $(abs_srcdir)/run.sh ../bin/hcl -x
AM_HCL_LOG_FLAGS = AM_HCL_LOG_FLAGS =
ERR_LOG_COMPILER = sh $(abs_srcdir)/err.sh ../bin/hcl -x
AM_ERR_LOG_FLAGS =

View File

@ -88,7 +88,7 @@ POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
check_PROGRAMS = check_PROGRAMS =
TESTS = $(am__EXEEXT_1) $(check_SCRIPTS) TESTS = $(am__EXEEXT_1) $(check_SCRIPTS) $(check_ERRORS)
subdir = t subdir = t
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \
@ -312,7 +312,7 @@ am__EXEEXT_1 =
TEST_SUITE_LOG = test-suite.log TEST_SUITE_LOG = test-suite.log
am__test_logs1 = $(TESTS:=.log) am__test_logs1 = $(TESTS:=.log)
am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
TEST_LOGS = $(am__test_logs2:.hcl.log=.log) am__test_logs3 = $(am__test_logs2:.hcl.log=.log)
HCL_LOG_DRIVER = $(SHELL) $(top_srcdir)/ac/test-driver HCL_LOG_DRIVER = $(SHELL) $(top_srcdir)/ac/test-driver
HCL_LOG_COMPILE = $(HCL_LOG_COMPILER) $(AM_HCL_LOG_FLAGS) \ HCL_LOG_COMPILE = $(HCL_LOG_COMPILER) $(AM_HCL_LOG_FLAGS) \
$(HCL_LOG_FLAGS) $(HCL_LOG_FLAGS)
@ -326,6 +326,10 @@ am__set_b = \
*) \ *) \
b='$*';; \ b='$*';; \
esac esac
TEST_LOGS = $(am__test_logs3:.err.log=.log)
ERR_LOG_DRIVER = $(SHELL) $(top_srcdir)/ac/test-driver
ERR_LOG_COMPILE = $(ERR_LOG_COMPILER) $(AM_ERR_LOG_FLAGS) \
$(ERR_LOG_FLAGS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/test-driver am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/test-driver
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@ ACLOCAL = @ACLOCAL@
@ -473,17 +477,22 @@ check_SCRIPTS = \
insta-02.hcl \ insta-02.hcl \
ret-01.hcl \ ret-01.hcl \
retvar-01.hcl \ retvar-01.hcl \
va-01.hcl \ va-01.hcl
var-01.hcl
EXTRA_DIST = $(check_SCRIPTS) check_ERRORS = \
TEST_EXTENSIONS = .hcl var-01.err \
var-02.err
EXTRA_DIST = $(check_SCRIPTS) $(check_ERRORS)
TEST_EXTENSIONS = .hcl .err
HCL_LOG_COMPILER = sh $(abs_srcdir)/run.sh ../bin/hcl -x HCL_LOG_COMPILER = sh $(abs_srcdir)/run.sh ../bin/hcl -x
AM_HCL_LOG_FLAGS = AM_HCL_LOG_FLAGS =
ERR_LOG_COMPILER = sh $(abs_srcdir)/err.sh ../bin/hcl -x
AM_ERR_LOG_FLAGS =
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .hcl .hcl$(EXEEXT) .log .trs .SUFFIXES: .err .err$(EXEEXT) .hcl .hcl$(EXEEXT) .log .trs
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \ @for dep in $?; do \
case '$(am__configure_deps)' in \ case '$(am__configure_deps)' in \
@ -690,6 +699,20 @@ recheck: all $(check_PROGRAMS) $(check_SCRIPTS)
@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_HCL_LOG_DRIVER_FLAGS) $(HCL_LOG_DRIVER_FLAGS) -- $(HCL_LOG_COMPILE) \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_HCL_LOG_DRIVER_FLAGS) $(HCL_LOG_DRIVER_FLAGS) -- $(HCL_LOG_COMPILE) \
@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
.err.log:
@p='$<'; \
$(am__set_b); \
$(am__check_pre) $(ERR_LOG_DRIVER) --test-name "$$f" \
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_ERR_LOG_DRIVER_FLAGS) $(ERR_LOG_DRIVER_FLAGS) -- $(ERR_LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
@am__EXEEXT_TRUE@.err$(EXEEXT).log:
@am__EXEEXT_TRUE@ @p='$<'; \
@am__EXEEXT_TRUE@ $(am__set_b); \
@am__EXEEXT_TRUE@ $(am__check_pre) $(ERR_LOG_DRIVER) --test-name "$$f" \
@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_ERR_LOG_DRIVER_FLAGS) $(ERR_LOG_DRIVER_FLAGS) -- $(ERR_LOG_COMPILE) \
@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
distdir: $(BUILT_SOURCES) distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am $(MAKE) $(AM_MAKEFLAGS) distdir-am

22
t/err.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/sh
for i in $@; do :; done
script="$i"
expected_errinfo=$(grep -E "##[[:space:]]+ERROR:" "$script" 2>/dev/null)
[ -z "$expected_errinfo" ] && {
echo "INVALID TESTER - $script contains no ERROR information"
exit 1
}
expected_errline=$(echo $expected_errinfo | cut -d: -f1)
xlen=$(echo $expected_errline | wc -c)
xlen=$(expr $xlen + 2)
expected_errmsg=$(echo $expected_errinfo | cut -c${xlen}-)
output=$($@ 2>&1)
echo "$output" | grep -E "ERROR:.+${script}.+${expected_errmsg}" || {
echo "$script - $output"
exit 1
}
exit 0

14
t/var-01.err Normal file
View File

@ -0,0 +1,14 @@
defclass Object {
{
## this must not be allowed at this level. if it's allowed,
## it should be at the top-level which is above the class level. this is confusing.
| j | ## ERROR: syntax error
set j 20;
printf ">>> %d\n" j;
}
defun ::* init() {
printf "Object init...\n";
return self;
};
};

3
t/var-02.err Normal file
View File

@ -0,0 +1,3 @@
## if you want local temporaries variables at the top-level, use the blocked expression.
| a | ## ERROR: syntax error - variable declaration disallowed
set a 10;