rerun test suite

This commit is contained in:
Peter McGoron 2023-04-07 19:49:53 +00:00
parent 0ead095044
commit 56c6523e15
3 changed files with 23 additions and 19 deletions

View File

@ -1,13 +1,14 @@
test: test_asm c_test/encode_decode c_test/creole
CFLAGS=-DCREOLE_TEST
asm/libcreole.so: creole.c creole.h
$(CC) -Wall -fPIC -c creole.c -o c_test/creole.o
$(CC) $(CFLAGS) -Wall -fPIC -c creole.c -o c_test/creole.o
$(CC) -shared -o asm/libcreole.so c_test/creole.o
test_asm: asm/libcreole.so
cd asm && python3 test.py -f
c_test/encode_decode: c_test/encode_decode.c creole.c creole.h
$(CC) creole.c c_test/encode_decode.c -Wall -pedantic -std=c89 -g -fopenmp -o c_test/encode_decode
$(CC) $(CFLAGS) creole.c c_test/encode_decode.c -Wall -pedantic -std=c99 -g -fopenmp -o c_test/encode_decode
# c_test/encode_decode
c_test/creole: c_test/creole.c creole.c creole.h c_test/greatest.h
$(CC) -g c_test/creole.c -Wall -pedantic -std=c89 -o c_test/creole
$(CC) $(CFLAGS) -g c_test/creole.c -Wall -pedantic -std=c99 -o c_test/creole
c_test/creole

View File

@ -60,7 +60,7 @@ class Reader:
class CEnv(Structure):
_fields_ = [
("dats", POINTER(POINTER(c_ubyte))),
("dats", POINTER(CReader)),
("datlen", c_size_t),
("reg", POINTER(c_uint)),
("reglen", c_size_t),
@ -68,7 +68,8 @@ class CEnv(Structure):
("stkptr", c_size_t),
("stklen", c_size_t),
("r_current", CReader),
("r_start", CReader)
("r_start", CReader),
("fd", c_int)
]
class RegisterOverflowError(Exception):
@ -116,13 +117,7 @@ class Environment:
def getdat(self, n):
if n >= self.cenv.datlen or n < 0:
raise DataOverflowError(n)
rdr = CReader()
rdr.p = self.cenv.dats[n]
# Python does not allow for direct pointer arithmetic
rdr_p_v = addressof(rdr.p.contents)
r_start_p_v = addressof(self.cenv.r_start.p)
rdr.left = self.cenv.r_start.left - (rdr_p_v - r_start_p_v)
rdr = self.cenv.dats[n]
l = []
w = CWord()
@ -143,7 +138,7 @@ class Environment:
def __init__(self, prog=None, reglen=32, datlen=32, stklen=4096, prglen=4096):
cenv = CEnv()
cenv.dats = (POINTER(c_ubyte) * datlen)()
cenv.dats = (CReader * datlen)()
cenv.datlen = datlen
cenv.reglen = reglen

View File

@ -12,13 +12,15 @@ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
#include <zephyr/kernel.h>
#include <zephyr/sys_clock.h>
#include "creole.h"
#include "access.h"
#include "control_loop_cmds.h"
#include "sock.h"
#ifndef CREOLE_TEST
# include <zephyr/kernel.h>
# include <zephyr/sys_clock.h>
# include "access.h"
# include "control_loop_cmds.h"
# include "sock.h"
#endif
#include "creole.h"
/*************************************************************************
* Static information
************************************************************************/
@ -556,6 +558,8 @@ int creole_jump(struct creole_env *env, creole_word off)
return 1;
}
#ifndef CREOLE_TEST
static size_t
load_into_array(const struct creole_reader *start, creole_word *buf, size_t buflen)
{
@ -608,6 +612,7 @@ upsilon_senddat(struct creole_env *env, creole_word db)
return sock_write_buf(env->fd, &bp);
}
#endif /* CREOLE_TEST */
/* Upsilon interface */
@ -719,6 +724,7 @@ enum creole_run_ret creole_step(struct creole_env *env, creole_word *sc)
return CREOLE_JUMP_OVERFLOW;
break;
#ifndef CREOLE_TEST
case CREOLE_READ_ADC:
check(read_val(env, &ins, 0, &a0));
@ -857,6 +863,8 @@ enum creole_run_ret creole_step(struct creole_env *env, creole_word *sc)
check(creole_push(env, dac_switch(a0, a1, K_FOREVER)));
break;
#endif /* CREOLE_TEST */
default:
rcode = CREOLE_STEP_UNKNOWN_OPCODE;
break;