diff options
author | Andrés <andmarti@gmail.com> | 2021-06-02 14:35:26 -0300 |
---|---|---|
committer | Andrés <andmarti@gmail.com> | 2021-06-02 14:35:26 -0300 |
commit | f94b16bfb779d6c5279628030dfe6f992518735d (patch) | |
tree | 570d1dae58bf61dacd8610ea2003d4609b7eecca /tests | |
parent | a8c21be20d841aed9b38aa6876eac4e1ecd6004a (diff) |
Added script to run all tests
Diffstat (limited to 'tests')
-rwxr-xr-x[-rw-r--r--] | tests/assert.sh | 0 | ||||
-rwxr-xr-x | tests/run_all_tests.sh | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | tests/test1.sh | 2 | ||||
-rw-r--r-- | tests/test1_vallog | 183 | ||||
-rw-r--r-- | tests/test2.sc | 15 | ||||
-rwxr-xr-x | tests/test2.sh | 18 |
6 files changed, 40 insertions, 184 deletions
diff --git a/tests/assert.sh b/tests/assert.sh index ffd2b95..ffd2b95 100644..100755 --- a/tests/assert.sh +++ b/tests/assert.sh diff --git a/tests/run_all_tests.sh b/tests/run_all_tests.sh new file mode 100755 index 0000000..cac47e1 --- /dev/null +++ b/tests/run_all_tests.sh @@ -0,0 +1,6 @@ +#!/bin/bash +for i in test*.sh +do + echo "Testing $i" + /bin/bash $i +done diff --git a/tests/test1.sh b/tests/test1.sh index bfd710e..661219d 100644..100755 --- a/tests/test1.sh +++ b/tests/test1.sh @@ -6,7 +6,6 @@ set -e NAME=test1 -echo -n $NAME": " VALGRIND_CMD='valgrind -v --log-file=${NAME}_vallog --tool=memcheck --track-origins=yes --leak-check=full --show-leak-kinds=all --show-reachable=no' . assert.sh assert "echo GETNUM C2 | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --nodebug --quit_afterload 2>&1 |grep -v '^$\|Interp'" "81" @@ -15,4 +14,5 @@ assert "echo GETNUM C2 | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --node #"in use at exit: 0 bytes in 0 blocks" #"All heap blocks were freed -- no leaks are possible" +rm ${NAME}_vallog assert_end test1 diff --git a/tests/test1_vallog b/tests/test1_vallog deleted file mode 100644 index a12afc0..0000000 --- a/tests/test1_vallog +++ /dev/null @@ -1,183 +0,0 @@ -==169506== Memcheck, a memory error detector -==169506== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. -==169506== Using Valgrind-3.17.0-07f0cdcbb4-20210319X and LibVEX; rerun with -h for copyright info -==169506== Command: ../src/sc-im test1.sc --nocurses --nodebug --quit_afterload -==169506== Parent PID: 169504 -==169506== ---169506-- ---169506-- Valgrind options: ---169506-- -v ---169506-- --log-file=test1_vallog ---169506-- --tool=memcheck ---169506-- --track-origins=yes ---169506-- --leak-check=full ---169506-- --show-leak-kinds=all ---169506-- --show-reachable=no ---169506-- Contents of /proc/version: ---169506-- Linux version 5.12.8-arch1-1 (linux@archlinux) (gcc (GCC) 11.1.0, GNU ld (GNU Binutils) 2.36.1) #1 SMP PREEMPT Fri, 28 May 2021 15:10:20 +0000 ---169506-- ---169506-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-lzcnt-rdtscp-sse3-ssse3-avx-avx2-bmi-f16c-rdrand-rdseed ---169506-- Page sizes: currently 4096, max supported 4096 ---169506-- Valgrind library directory: /usr/lib/valgrind ---169506-- Reading syms from /home/mongo/scim/src/sc-im ---169506-- Reading syms from /usr/lib/ld-2.33.so ---169506-- Reading syms from /usr/lib/valgrind/memcheck-amd64-linux ---169506-- object doesn't have a dynamic symbol table ---169506-- Scheduler: using generic scheduler lock implementation. ---169506-- Reading suppressions file: /usr/lib/valgrind/default.supp -==169506== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-169506-by-mongo-on-??? -==169506== embedded gdbserver: writing to /tmp/vgdb-pipe-to-vgdb-from-169506-by-mongo-on-??? -==169506== embedded gdbserver: shared mem /tmp/vgdb-pipe-shared-mem-vgdb-169506-by-mongo-on-??? -==169506== -==169506== TO CONTROL THIS PROCESS USING vgdb (which you probably -==169506== don't want to do, unless you know exactly what you're doing, -==169506== or are doing some strange experiment): -==169506== /usr/lib/valgrind/../../bin/vgdb --pid=169506 ...command... -==169506== -==169506== TO DEBUG THIS PROCESS USING GDB: start GDB like this -==169506== /path/to/gdb ../src/sc-im -==169506== and then give GDB the following command -==169506== target remote | /usr/lib/valgrind/../../bin/vgdb --pid=169506 -==169506== --pid is optional if only one valgrind process is running -==169506== ---169506-- REDIR: 0x4023890 (ld-linux-x86-64.so.2:strlen) redirected to 0x580bb342 (vgPlain_amd64_linux_REDIR_FOR_strlen) ---169506-- REDIR: 0x4023660 (ld-linux-x86-64.so.2:index) redirected to 0x580bb35c (vgPlain_amd64_linux_REDIR_FOR_index) ---169506-- Reading syms from /usr/lib/valgrind/vgpreload_core-amd64-linux.so ---169506-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so -==169506== WARNING: new redirection conflicts with existing -- ignoring it ---169506-- old: 0x04023890 (strlen ) R-> (0000.0) 0x580bb342 vgPlain_amd64_linux_REDIR_FOR_strlen ---169506-- new: 0x04023890 (strlen ) R-> (2007.0) 0x048448d0 strlen ---169506-- REDIR: 0x4020070 (ld-linux-x86-64.so.2:strcmp) redirected to 0x4845730 (strcmp) ---169506-- REDIR: 0x4023df0 (ld-linux-x86-64.so.2:mempcpy) redirected to 0x48491a0 (mempcpy) ---169506-- Reading syms from /usr/lib/libm-2.33.so ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libdl-2.33.so ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libncursesw.so.6.2 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libxml2.so.2.9.10 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libzip.so.5.3 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libxlsxwriter.so ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/liblua.so.5.4.3 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libpthread-2.33.so ---169506-- Reading syms from /usr/lib/libc-2.33.so ---169506-- Reading syms from /usr/lib/libicuuc.so.69.1 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libz.so.1.2.11 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/liblzma.so.5.2.5 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libbz2.so.1.0.8 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libgnutls.so.30.30.0 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libnettle.so.8.3 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libstdc++.so.6.0.29 ---169506-- Reading syms from /usr/lib/libgcc_s.so.1 ---169506-- Reading syms from /usr/lib/libp11-kit.so.0.3.0 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libidn2.so.0.3.7 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libunistring.so.2.1.0 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libtasn1.so.6.6.1 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libhogweed.so.6.3 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libgmp.so.10.4.1 ---169506-- object doesn't have a symbol table ---169506-- Reading syms from /usr/lib/libffi.so.7.1.0 ---169506-- object doesn't have a symbol table ---169506-- REDIR: 0x4d0c0b0 (libc.so.6:memmove) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) -==169506== Preferring higher priority redirection: ---169506-- old: 0x04ddf510 (__memcpy_avx_unalign) R-> (2018.0) 0x04846980 __memcpy_avx_unaligned_erms ---169506-- new: 0x04ddf510 (__memcpy_avx_unalign) R-> (2018.1) 0x04848220 memmove ---169506-- REDIR: 0x4d0b5b0 (libc.so.6:strncpy) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0c3f0 (libc.so.6:strcasecmp) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0b050 (libc.so.6:strcat) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0b610 (libc.so.6:rindex) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0d7a0 (libc.so.6:rawmemchr) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d257f0 (libc.so.6:wmemchr) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d25330 (libc.so.6:wcscmp) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0c210 (libc.so.6:mempcpy) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0c040 (libc.so.6:bcmp) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0b540 (libc.so.6:strncmp) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0b100 (libc.so.6:strcmp) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0c180 (libc.so.6:memset) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d252f0 (libc.so.6:wcschr) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0b4a0 (libc.so.6:strnlen) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0b1e0 (libc.so.6:strcspn) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0c440 (libc.so.6:strncasecmp) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0b180 (libc.so.6:strcpy) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0c590 (libc.so.6:memcpy@@GLIBC_2.14) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d26a40 (libc.so.6:wcsnlen) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d25370 (libc.so.6:wcscpy) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0b650 (libc.so.6:strpbrk) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0b0b0 (libc.so.6:index) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0b460 (libc.so.6:strlen) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d11c10 (libc.so.6:memrchr) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0c490 (libc.so.6:strcasecmp_l) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0c000 (libc.so.6:memchr) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d25440 (libc.so.6:wcslen) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0b770 (libc.so.6:strspn) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0c390 (libc.so.6:stpncpy) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0c330 (libc.so.6:stpcpy) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0d7e0 (libc.so.6:strchrnul) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0c4e0 (libc.so.6:strncasecmp_l) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0bf20 (libc.so.6:strstr) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d87a70 (libc.so.6:__memcpy_chk) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d0b4e0 (libc.so.6:strncat) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4d87b40 (libc.so.6:__memmove_chk) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) -==169506== WARNING: new redirection conflicts with existing -- ignoring it ---169506-- old: 0x04ddf500 (__memcpy_chk_avx_una) R-> (2030.0) 0x04849290 __memcpy_chk ---169506-- new: 0x04ddf500 (__memcpy_chk_avx_una) R-> (2024.0) 0x04848c30 __memmove_chk -==169506== WARNING: new redirection conflicts with existing -- ignoring it ---169506-- old: 0x04ddf500 (__memcpy_chk_avx_una) R-> (2030.0) 0x04849290 __memcpy_chk ---169506-- new: 0x04ddf500 (__memcpy_chk_avx_una) R-> (2024.0) 0x04848c30 __memmove_chk -==169506== WARNING: new redirection conflicts with existing -- ignoring it ---169506-- old: 0x04ddf500 (__memcpy_chk_avx_una) R-> (2030.0) 0x04849290 __memcpy_chk ---169506-- new: 0x04ddf500 (__memcpy_chk_avx_una) R-> (2024.0) 0x04848c30 __memmove_chk ---169506-- REDIR: 0x4d254e0 (libc.so.6:wcsncmp) redirected to 0x48331b0 (_vgnU_ifunc_wrapper) ---169506-- REDIR: 0x4ddc330 (libc.so.6:__strrchr_avx2) redirected to 0x4844310 (rindex) ---169506-- REDIR: 0x4ddc500 (libc.so.6:__strlen_avx2) redirected to 0x48447b0 (strlen) ---169506-- REDIR: 0x4dd8af0 (libc.so.6:__memcmp_avx2_movbe) redirected to 0x48479c0 (bcmp) ---169506-- REDIR: 0x4dd7e30 (libc.so.6:__strncmp_avx2) redirected to 0x4844e80 (strncmp) ---169506-- REDIR: 0x4ddbf10 (libc.so.6:__strchr_avx2) redirected to 0x4844490 (index) ---169506-- REDIR: 0x4dd79f0 (libc.so.6:__strcmp_avx2) redirected to 0x4845630 (strcmp) ---169506-- REDIR: 0x4d07320 (libc.so.6:malloc) redirected to 0x483e750 (malloc) ---169506-- REDIR: 0x4ddf510 (libc.so.6:__memcpy_avx_unaligned_erms) redirected to 0x4848220 (memmove) ---169506-- REDIR: 0x4d080f0 (libc.so.6:calloc) redirected to 0x4843550 (calloc) ---169506-- REDIR: 0x4ddf500 (libc.so.6:__memcpy_chk_avx_unaligned_erms) redirected to 0x4849290 (__memcpy_chk) ---169506-- REDIR: 0x4d07980 (libc.so.6:free) redirected to 0x4841120 (free) ---169506-- REDIR: 0x4dd8360 (libc.so.6:__memchr_avx2) redirected to 0x48457b0 (memchr) ---169506-- REDIR: 0x4ddc140 (libc.so.6:__strchrnul_avx2) redirected to 0x4848ca0 (strchrnul) ---169506-- REDIR: 0x4ddf4f0 (libc.so.6:__mempcpy_avx_unaligned_erms) redirected to 0x4848db0 (mempcpy) ---169506-- REDIR: 0x4dde730 (libc.so.6:__stpcpy_avx2) redirected to 0x4847ae0 (stpcpy) ---169506-- REDIR: 0x4d0bc20 (libc.so.6:__GI_strstr) redirected to 0x4849430 (__strstr_sse2) ---169506-- REDIR: 0x4ddddd0 (libc.so.6:__strncpy_avx2) redirected to 0x4844a80 (strncpy) ---169506-- REDIR: 0x4d07c20 (libc.so.6:realloc) redirected to 0x48437c0 (realloc) ---169506-- REDIR: 0x4ddf9a0 (libc.so.6:__memset_avx2_unaligned_erms) redirected to 0x4848120 (memset) ---169506-- REDIR: 0x4ddda40 (libc.so.6:__strcpy_avx2) redirected to 0x4844900 (strcpy) ---169506-- REDIR: 0x4ddd030 (libc.so.6:__strncat_avx2) redirected to 0x4844660 (strncat) ---169506-- REDIR: 0x4d24410 (libc.so.6:__strstr_sse2_unaligned) redirected to 0x48493a0 (strstr) ---169506-- REDIR: 0x4dd8ed0 (libc.so.6:__strcasecmp_avx) redirected to 0x4845000 (strcasecmp) ---169506-- REDIR: 0x4dd78c0 (libc.so.6:__strspn_sse42) redirected to 0x4849690 (strspn) ---169506-- REDIR: 0x4dd7660 (libc.so.6:__strcspn_sse42) redirected to 0x48495b0 (strcspn) ---169506-- REDIR: 0x4ddc6a0 (libc.so.6:__strnlen_avx2) redirected to 0x4844750 (strnlen) ---169506-- REDIR: 0x4dd8630 (libc.so.6:__rawmemchr_avx2) redirected to 0x4848cd0 (rawmemchr) ---169506-- REDIR: 0x4ddfe20 (libc.so.6:__wmemchr_avx2) redirected to 0x4849a40 (wmemchr) ---169506-- REDIR: 0x4de1040 (libc.so.6:__wcsnlen_avx2) redirected to 0x4849830 (wcsnlen) ---169506-- REDIR: 0x4de0e80 (libc.so.6:__wcslen_avx2) redirected to 0x4849800 (wcslen) -==169506== -==169506== HEAP SUMMARY: -==169506== in use at exit: 0 bytes in 0 blocks -==169506== total heap usage: 4,398 allocs, 4,398 frees, 424,410 bytes allocated -==169506== -==169506== All heap blocks were freed -- no leaks are possible -==169506== -==169506== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) diff --git a/tests/test2.sc b/tests/test2.sc new file mode 100644 index 0000000..a5eb292 --- /dev/null +++ b/tests/test2.sc @@ -0,0 +1,15 @@ +# This data file was generated by the Spreadsheet Calculator Improvised (sc-im) +# You almost certainly shouldn't edit it. + +newsheet "Sheet1" +movetosheet "Sheet1" +let A0 = B0+2 +let B0 = 23 +newsheet "Sheet2" +movetosheet "Sheet2" +let A0 = 56 +movetosheet "Sheet1" +let C2 = {"Sheet2"}!A0 + A0 +undo +redo +goto B0 diff --git a/tests/test2.sh b/tests/test2.sh new file mode 100755 index 0000000..c514f2a --- /dev/null +++ b/tests/test2.sh @@ -0,0 +1,18 @@ +#!/bin/bash +## SEE https://github.com/lehmannro/assert.sh for usage + +#Exit immediately if a command exits with a non-zero status. +set -e + +NAME=test2 + +VALGRIND_CMD='valgrind -v --log-file=${NAME}_vallog --tool=memcheck --track-origins=yes --leak-check=full --show-leak-kinds=all --show-reachable=no' +. assert.sh +assert "echo GETNUM C2 | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --nodebug --quit_afterload 2>&1 |grep -v '^$\|Interp\|left'" "81" + +#TODO: check valgrind log here +#"in use at exit: 0 bytes in 0 blocks" +#"All heap blocks were freed -- no leaks are possible" + +rm ${NAME}_vallog +assert_end ${NAME} |