rerun test suite
This commit is contained in:
parent
0ead095044
commit
56c6523e15
7
Makefile
7
Makefile
|
@ -1,13 +1,14 @@
|
||||||
test: test_asm c_test/encode_decode c_test/creole
|
test: test_asm c_test/encode_decode c_test/creole
|
||||||
|
CFLAGS=-DCREOLE_TEST
|
||||||
asm/libcreole.so: creole.c creole.h
|
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
|
$(CC) -shared -o asm/libcreole.so c_test/creole.o
|
||||||
|
|
||||||
test_asm: asm/libcreole.so
|
test_asm: asm/libcreole.so
|
||||||
cd asm && python3 test.py -f
|
cd asm && python3 test.py -f
|
||||||
c_test/encode_decode: c_test/encode_decode.c creole.c creole.h
|
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/encode_decode
|
||||||
c_test/creole: c_test/creole.c creole.c creole.h c_test/greatest.h
|
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
|
c_test/creole
|
||||||
|
|
15
asm/ffi.py
15
asm/ffi.py
|
@ -60,7 +60,7 @@ class Reader:
|
||||||
|
|
||||||
class CEnv(Structure):
|
class CEnv(Structure):
|
||||||
_fields_ = [
|
_fields_ = [
|
||||||
("dats", POINTER(POINTER(c_ubyte))),
|
("dats", POINTER(CReader)),
|
||||||
("datlen", c_size_t),
|
("datlen", c_size_t),
|
||||||
("reg", POINTER(c_uint)),
|
("reg", POINTER(c_uint)),
|
||||||
("reglen", c_size_t),
|
("reglen", c_size_t),
|
||||||
|
@ -68,7 +68,8 @@ class CEnv(Structure):
|
||||||
("stkptr", c_size_t),
|
("stkptr", c_size_t),
|
||||||
("stklen", c_size_t),
|
("stklen", c_size_t),
|
||||||
("r_current", CReader),
|
("r_current", CReader),
|
||||||
("r_start", CReader)
|
("r_start", CReader),
|
||||||
|
("fd", c_int)
|
||||||
]
|
]
|
||||||
|
|
||||||
class RegisterOverflowError(Exception):
|
class RegisterOverflowError(Exception):
|
||||||
|
@ -116,13 +117,7 @@ class Environment:
|
||||||
def getdat(self, n):
|
def getdat(self, n):
|
||||||
if n >= self.cenv.datlen or n < 0:
|
if n >= self.cenv.datlen or n < 0:
|
||||||
raise DataOverflowError(n)
|
raise DataOverflowError(n)
|
||||||
rdr = CReader()
|
rdr = self.cenv.dats[n]
|
||||||
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)
|
|
||||||
|
|
||||||
l = []
|
l = []
|
||||||
w = CWord()
|
w = CWord()
|
||||||
|
@ -143,7 +138,7 @@ class Environment:
|
||||||
|
|
||||||
def __init__(self, prog=None, reglen=32, datlen=32, stklen=4096, prglen=4096):
|
def __init__(self, prog=None, reglen=32, datlen=32, stklen=4096, prglen=4096):
|
||||||
cenv = CEnv()
|
cenv = CEnv()
|
||||||
cenv.dats = (POINTER(c_ubyte) * datlen)()
|
cenv.dats = (CReader * datlen)()
|
||||||
cenv.datlen = datlen
|
cenv.datlen = datlen
|
||||||
|
|
||||||
cenv.reglen = reglen
|
cenv.reglen = reglen
|
||||||
|
|
10
creole.c
10
creole.c
|
@ -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
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||||
|
|
||||||
|
#ifndef CREOLE_TEST
|
||||||
# include <zephyr/kernel.h>
|
# include <zephyr/kernel.h>
|
||||||
# include <zephyr/sys_clock.h>
|
# include <zephyr/sys_clock.h>
|
||||||
#include "creole.h"
|
|
||||||
# include "access.h"
|
# include "access.h"
|
||||||
# include "control_loop_cmds.h"
|
# include "control_loop_cmds.h"
|
||||||
# include "sock.h"
|
# include "sock.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "creole.h"
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* Static information
|
* Static information
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
@ -556,6 +558,8 @@ int creole_jump(struct creole_env *env, creole_word off)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef CREOLE_TEST
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
load_into_array(const struct creole_reader *start, creole_word *buf, size_t buflen)
|
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);
|
return sock_write_buf(env->fd, &bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* CREOLE_TEST */
|
||||||
|
|
||||||
/* Upsilon interface */
|
/* Upsilon interface */
|
||||||
|
|
||||||
|
@ -719,6 +724,7 @@ enum creole_run_ret creole_step(struct creole_env *env, creole_word *sc)
|
||||||
return CREOLE_JUMP_OVERFLOW;
|
return CREOLE_JUMP_OVERFLOW;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifndef CREOLE_TEST
|
||||||
|
|
||||||
case CREOLE_READ_ADC:
|
case CREOLE_READ_ADC:
|
||||||
check(read_val(env, &ins, 0, &a0));
|
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)));
|
check(creole_push(env, dac_switch(a0, a1, K_FOREVER)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#endif /* CREOLE_TEST */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
rcode = CREOLE_STEP_UNKNOWN_OPCODE;
|
rcode = CREOLE_STEP_UNKNOWN_OPCODE;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue