compatible with macos base64 impl in tests

This commit is contained in:
CismonX 2020-03-15 16:21:18 +08:00
parent ed8eb8dff7
commit 6d4b94bdf7
No known key found for this signature in database
GPG Key ID: 315D6652268C5007
5 changed files with 14 additions and 12 deletions

View File

@ -11,12 +11,14 @@ case "${host_os}" in
linux*)
AC_SUBST([MANPATH_CONF], [/etc/manpath.config])
AC_SUBST([REBUILD_MANDB], [mandb])
AC_SUBST([BASE64_FLAGS], [-w0])
AC_SUBST([BASE64_ENCODE], [-w0])
AC_SUBST([BASE64_DECODE], [-d])
;;
darwin*)
AC_SUBST([MANPATH_CONF], [/private/etc/man.conf])
AC_SUBST([REBUILD_MANDB], [/usr/libexec/makewhatis])
AC_SUBST([BASE64_FLAGS], [-b0])
AC_SUBST([BASE64_ENCODE], [-b0])
AC_SUBST([BASE64_DECODE], [-D])
;;
*)
AC_MSG_ERROR(["Unsupported OS: ${host_os}"])

View File

@ -6,6 +6,7 @@ u6ac_SOURCES = logging.c lexer.c parser.c codegen.c u6ac.c
u6a_SOURCES = logging.c vm_stack.c vm_pool.c runtime.c u6a.c
TEST_DIR = ${srcdir}/../tests
DEJAGNU_GLOBALS = U6A_BIN=${srcdir}/u6a U6AC_BIN=${srcdir}/u6ac U6A_RUN=${TEST_DIR}/u6a_run B64_FLAGS=${BASE64_FLAGS}
RUNTESTDEFAULTFLAGS = --srcdir=${TEST_DIR} --tool default ${DEJAGNU_GLOBALS}
DEJAGNU_GLOBALS_BIN = U6A_BIN=${srcdir}/u6a U6AC_BIN=${srcdir}/u6ac U6A_RUN=${TEST_DIR}/u6a_run
DEJAGNU_GLOBALS_BASE64 = B64_ENCODE=${BASE64_ENCODE} B64_DECODE=${BASE64_DECODE}
RUNTESTDEFAULTFLAGS = --srcdir=${TEST_DIR} --tool default ${DEJAGNU_GLOBALS_BIN} ${DEJAGNU_GLOBALS_BASE64}
EXTRA_DEJAGNU_SITE_CONFIG = ../tests/init.exp

View File

@ -19,11 +19,11 @@
set tool "default"
set timeout 1
global B64_FLAGS
global B64_ENCODE
set rand_str_list { }
for { set i 100 } { $i < 200 } { incr i } {
lappend rand_str_list [ exec head -c $i /dev/urandom | base64 $B64_FLAGS ]
lappend rand_str_list [ exec head -c $i /dev/urandom | base64 $B64_ENCODE ]
}
u6a_run "```s`d`@|i`ci" - - 1

View File

@ -18,11 +18,10 @@
##
proc u6a_run { src_code u6ac_opts u6a_opts has_input } {
global U6A_BIN U6AC_BIN U6A_RUN B64_FLAGS
global U6A_BIN U6AC_BIN U6A_RUN B64_ENCODE B64_DECODE
set u6ac "$U6AC_BIN $u6ac_opts"
set u6a "$U6A_BIN $u6a_opts"
set base64 "base64 $B64_FLAGS"
set run_cmd [ list $U6A_RUN $u6ac $u6a $base64 $src_code ]
set run_cmd [ list $U6A_RUN $u6ac $u6a $B64_ENCODE $B64_DECODE $src_code ]
if $has_input {
lappend run_cmd -
set stty_init -echo

View File

@ -18,8 +18,8 @@
## along with this program. If not, see <https://www.gnu.org/licenses/>.
##
U6A_BYTECODE=`echo $4 | $1 - | $3`
U6A_BYTECODE=`echo $5 | $1 - | base64 $3`
test -z $U6A_BYTECODE && exit -1
cat <(echo $U6A_BYTECODE | base64 -d) <(test $5 && cat $5) | $2 -
cat <(echo $U6A_BYTECODE | base64 $4) <(test $6 && cat $6) | $2 -
# Usage: ./u6a_run /path/to/u6ac/bin /path/to/u6a/bin /path/to/base64/bin source_code [input]
# Usage: ./u6a_run u6ac_bin u6a_bin b64_encode_ops b64_decode_ops src_code [input_file]