Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ ifdef NO_DEVICES
CFLAGS += -DNO_DEVICES
endif

ifdef TESTING
CFLAGS += -DTESTING
endif

ifdef LOGBUF
CFLAGS += -DH2K_LOGBUF
endif
Expand Down
30 changes: 16 additions & 14 deletions kernel/power/apcr/simple_test/Makefile
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
EXEC = test.elf
OBJS += test.o

H2DIR=${UPDIR}../../../..

include ${H2DIR}/scripts/Makefile.inc.test
include $(H2DIR)/scripts/Makefile.inc.tools
include Makefile.inc

ifeq ($(INSTALLPATH),)
export INSTALLPATH := $(H2DIR)/install
endif

ifeq ($(KERNELPATH),)
export KERNELPATH := $(H2DIR)/kernel
endif

H2K_KERNEL_PGSIZE := 2
H2K_ALLOC_HEAP_SIZE := 0x1000

BOOTVM_PROG := .test.elf

ifeq ($(TARGET), rtl)
CRT0_S := $(INSTALLPATH)/src/min_crt0.S
CRT0_O := min_crt0.o
NOSTARTFILES := -nostartfiles
EXTRA_CFLAGS += -DRTL
else
EXTRA_CFLAGS += -DDEBUG
endif


CFLAGS = $(OPTIMIZE) -mv$(TOOLARCH) -DARCHV=$(ARCHV) -Wall -Werror -g -I$(INSTALLPATH)/include -I$(KERNELPATH)/include $(EXTRA_CFLAGS)
LDFLAGS = -nostartfiles -L$(INSTALLPATH)/lib -moslib=h2 -Qunused-arguments
CFLAGS := $(OPTIMIZE) -mv$(TOOLARCH) -DARCHV=$(ARCHV) -Wall -Werror -g -I$(INSTALLPATH)/include -I$(KERNELPATH)/include -Wno-builtin-requires-header $(EXTRA_CFLAGS)
BOOTVM_LDFLAGS = $(NOSTARTFILES) -L$(INSTALLPATH)/lib -moslib=h2 -Qunused-arguments

all: $(BOOTVM_PROG)

include $(H2DIR)/scripts/Makefile.inc.config
include $(H2DIR)/scripts/Makefile.inc.opensource
include $(H2DIR)/scripts/Makefile.inc.bootvm

CLEANUP += *.elf $(BOOTVM_CLEAN) hello stats.* *.o pmu_statsfile.txt

$(BOOTVM_IMAGE): LDFLAGS = $(BOOTVM_LDFLAGS)
$(BOOTVM_PROG_TMP): LDFLAGS = $(BOOTVM_LDFLAGS)
$(BOOTVM_PROG): LDFLAGS = $(BOOTVM_LDFLAGS)

$(BOOTVM_IMAGE): test.o $(CRT0_O) $(BOOTVM_IMAGE_DEPS)
${CC} $(LDFLAGS) $(CFLAGS) $(BOOTVM_IMAGE_CFLAGS) -Wl,--defsym=HEAP_SIZE=0x10000 -Wl,--defsym=STACK_SIZE=0x1000 -o $@ test.o $(CRT0_O) $(BOOTVM_ENTRY_O)
${CC} $(LDFLAGS) $(CFLAGS) $(BOOTVM_IMAGE_CFLAGS) -Wl,--defsym=HEAP_SIZE=0x10000 -Wl,--defsym=STACK_SIZE=0x1000 -Wl,--defsym=__h2_thread_stop_hook__=0xfffffff0 -o $@ test.o $(CRT0_O) $(BOOTVM_ENTRY_O) 2>&1 | perl -pe 's/.*Symbol.*__h2_.*_hook__.*is defined in both linker script and input file.*//';


# This bit of stupidity is needed to suppress warnings about changing the
# recipe for test.elf
Expand Down
7 changes: 3 additions & 4 deletions kernel/power/apcr/simple_test/Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Not an H2 regression test (for now?)

# # Need to define how to get back to the main H2 dir
# H2DIR=${UPDIR}../../../..

# # Everything else defined here
# include ${H2DIR}/scripts/Makefile.inc.test
H2DIR=${UPDIR}../../../..
# Everything else defined here
include ${H2DIR}/scripts/Makefile.inc.test
28 changes: 18 additions & 10 deletions kernel/power/apcr/simple_test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,46 @@
*/

#include <h2.h>
/* #include <h2_cache.h> */
/* #include <h2_intwait.h> */
/* #include <h2_thread.h> */
#include <stdio.h>
#include <stdlib.h>

#ifndef DEBUG
#ifdef RTL
#define ITERS 1
#ifndef INTERRUPT_NUM
#define INTERRUPT_NUM 3
#endif
#else
#define ITERS 2
#ifndef INTERRUPT_NUM
#define INTERRUPT_NUM 5
#define HAVE_TIMER
#endif

#ifdef HAVE_TIMER
#define SLEEP (1000*1000*5)
#endif

#define PASSFAIL_VA 0x01000000
#define PASSFAIL_VA (H2K_GUEST_START + 0x01000000)

int main()
int main()
{
int i;
unsigned int *sigil = (void *)(PASSFAIL_VA);

for (i = 0; i < ITERS; i++) {
#ifdef HAVE_TIMER
h2_nanosleep(SLEEP);
#else
h2_intwait(INTERRUPT_NUM);

#ifdef DEBUG
#endif
#ifndef RTL
*sigil = i + 1;
#endif
}
*sigil = 0xe0f0beef;
h2_dccleana(sigil);
#ifndef RTL
printf("TEST PASSED\n");
exit(0);
#endif
h2_thread_stop_trap(0);
return 0;
}
Expand Down
12 changes: 5 additions & 7 deletions kernel/power/apcr/test_multi/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
EXEC = test.elf
OBJS += test.o
#OBJS += $(BOOTVM_ENTRY_O)

include Makefile.inc


ifeq ($(INSTALLPATH),)
export INSTALLPATH := $(H2DIR)/install
endif

# ifeq ($(KERNELPATH),)
# export KERNELPATH := $(H2DIR)/kernel
# endif

H2K_KERNEL_PGSIZE := 2

BOOTVM_PROG := .test.elf
Expand All @@ -26,15 +22,17 @@ EXTRA_CFLAGS += -DDEBUG
endif

CFLAGS := $(OPTIMIZE) -mv$(TOOLARCH) -DARCHV=$(ARCHV) -Wall -Werror -g -I$(INSTALLPATH)/include -I$(KERNELPATH)/include -Wno-builtin-requires-header $(EXTRA_CFLAGS)
LDFLAGS = $(NOSTARTFILES) -L$(INSTALLPATH)/lib -moslib=h2 -Qunused-arguments

BOOTVM_LDFLAGS = $(NOSTARTFILES) -L$(INSTALLPATH)/lib -moslib=h2 -Qunused-arguments

all: $(BOOTVM_PROG)

include $(H2DIR)/scripts/Makefile.inc.bootvm

CLEANUP += *.elf $(BOOTVM_CLEAN) hello stats.* *.o pmu_statsfile.txt

$(BOOTVM_IMAGE): LDFLAGS = $(BOOTVM_LDFLAGS)
$(BOOTVM_PROG_TMP): LDFLAGS = $(BOOTVM_LDFLAGS)
$(BOOTVM_PROG): LDFLAGS = $(BOOTVM_LDFLAGS)

$(BOOTVM_IMAGE): test.o $(CRT0_O) $(BOOTVM_IMAGE_DEPS)
${CC} $(LDFLAGS) $(CFLAGS) $(BOOTVM_IMAGE_CFLAGS) -Wl,--defsym=HEAP_SIZE=0x10000 -Wl,--defsym=STACK_SIZE=0x1000 -Wl,--defsym=__h2_thread_stop_hook__=0xfffffff0 -o $@ test.o $(CRT0_O) $(BOOTVM_ENTRY_O) 2>&1 | perl -pe 's/.*Symbol.*__h2_.*_hook__.*is defined in both linker script and input file.*//';
Expand Down
2 changes: 2 additions & 0 deletions kernel/time/timer/timer.ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ static inline ticks_t H2K_timer_hw_read_count()
};
} ticktmp;

#ifndef TESTING
if (H2K_gp->arch >= CORE_V61) { // use core timer regs
return H2K_get_timer_reg();
}
#endif

do {
tmphi = H2K_gp->time.devptr[HW_COUNT_HI];
Expand Down
21 changes: 21 additions & 0 deletions kernel/time/timer/timer.v60opt.S
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,16 @@ FUNC_START H2K_timer_get_ticks .text.time.timer .falign
if (p0.new) TICKLO = memw(DEVPTR+#HW_COUNT_LO-HW_COUNT_LO)
if (p0.new) jump:nt 1f
}
#ifndef TESTING
{
TICKS = TIMERHILO
}
#else
{
TICKHI = memw(DEVPTR+#HW_COUNT_HI-HW_COUNT_LO)
TICKLO = memw(DEVPTR+#HW_COUNT_LO-HW_COUNT_LO)
}
#endif
1:
{
p1 = cmp.gtu(TICKS,LASTTICKS) // nowticks > last_ticks?
Expand Down Expand Up @@ -337,9 +344,16 @@ FUNC_START H2K_timer_get_time .text.time.timer
if (p0.new) TICKS_LO = memw(DEVPTR+#HW_COUNT_LO-HW_COUNT_LO)
if (p0.new) jump:nt 1f
}
#ifndef TESTING
{
TICKS = TIMERHILO
}
#else
{
TICKS_HI = memw(DEVPTR+#HW_COUNT_HI-HW_COUNT_LO)
TICKS_LO = memw(DEVPTR+#HW_COUNT_LO-HW_COUNT_LO)
}
#endif
1:
{
p1 = cmp.gtu(TICKS,LAST_TICKS) // nowticks > last_ticks?
Expand Down Expand Up @@ -620,9 +634,16 @@ FUNC_START H2K_timer_delta_timeout .text.time.timer
p0 = cmp.ltu(CREV, V61)
if (p0.new) jump:nt 2f
}
#ifndef TESTING
{
TICKS = TIMERHILO
}
#else
{
TICKS_HI = memw(DEVPTR+#HW_COUNT_HI-HW_COUNT_LO)
TICKS_LO = memw(DEVPTR+#HW_COUNT_LO-HW_COUNT_LO)
}
#endif
#undef MAGIC_HI
2:
{
Expand Down
5 changes: 4 additions & 1 deletion libs/h2/vmtraps/test/test_pcycles/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
#elif ARCHV == 5
#define PCYCLES_PER_TCYCLE 3
#define OVERHEAD 1536
#elif ARCHV == 60
#elif ARCHV >= 68
#define PCYCLES_PER_TCYCLE 3
#define OVERHEAD 1536
#elif ARCHV >= 60
#define PCYCLES_PER_TCYCLE 2
#define OVERHEAD 1536
#else
Expand Down
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ ifeq ($(USE_PKW),1)
@echo PKW_VERSIONS $(PKW_VERSIONS)
pkw --which $(CC)
endif
$(MAKE) $(OPT_JFLAG) -C kernel ARCHV=$(ARCHV) opt_install && \
$(MAKE) $(OPT_JFLAG) -C kernel ARCHV=$(ARCHV) TESTING=$(TESTING) opt_install && \
$(MAKE) $(OPT_JFLAG) -C libs ARCHV=$(ARCHV) install IMPL=opt && \
$(MAKE) $(OPT_JFLAG) -C stake ARCHV=$(ARCHV) install
$(MAKE) $(OPT_JFLAG) -C booter ARCHV=$(ARCHV) install
Expand All @@ -214,7 +214,7 @@ ifeq ($(USE_PKW),1)
@echo PKW_VERSIONS $(PKW_VERSIONS)
pkw --which $(CC)
endif
$(MAKE) $(REF_JFLAG) -C kernel ARCHV=$(ARCHV) ref_install && \
$(MAKE) $(REF_JFLAG) -C kernel ARCHV=$(ARCHV) TESTING=$(TESTING) ref_install && \
$(MAKE) $(REF_JFLAG) -C libs ARCHV=$(ARCHV) install IMPL=ref && \
$(MAKE) $(REF_JFLAG) -C stake ARCHV=$(ARCHV) install
$(MAKE) $(REF_JFLAG) -C booter ARCHV=$(ARCHV) install
Expand Down
28 changes: 14 additions & 14 deletions scripts/testlist.v61
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
./kernel/mem/tlbmisc/test
./kernel/mem/tlbmiss/test
#./kernel/mem/varadix/test FIXME: needs to adapt to different kernel page size/count
#./kernel/power/apcr/test_multi FIXME: needs changes to work with new ${EXEC}_tmp make target
./kernel/power/apcr/test_multi
./kernel/power/hvx/test
#./kernel/power/apcr/simple_test
./kernel/power/apcr/simple_test
./kernel/sched/check_sanity/test/tests/H2K_check_sanity/scenarios
./kernel/sched/dosched/test/test
./kernel/futex/futex/test/tests/badaccess
Expand All @@ -59,7 +59,7 @@
# ./kernel/traps/tlb/test FIXME: needs to adapt to different kernel page size/count
./kernel/traps/waitcycles/test
./kernel/traps/info/test
# ./kernel/time/timer/test_standalone # out for ARCHV > 60 because can't set timer regs
./kernel/time/timer/test_standalone # out for ARCHV > 60 because can't set timer regs
./kernel/time/timer/test_h2
./kernel/time/timer/test_h2_multi
./kernel/util/atomic/test
Expand All @@ -82,17 +82,17 @@
./kernel/vm/vmmap/test
./kernel/vm/vmcache/test

#./libs/h2/alloc/test
#./libs/h2/allsignal/test/simple
#./libs/h2/allsignal/test/trapfails
#./libs/h2/anysignal/test/simple
#./libs/h2/anysignal/test/trapfails
#./libs/h2/error/test/simple
#./libs/h2/sem/test/simple
#./libs/h2/sleep/test
#./libs/h2/vmtraps/test/test_ie
#./libs/h2/vmtraps/test/test_pcycles
#./libs/h2/vmtraps/test/test_return
./libs/h2_compat/alloc/test
./libs/h2_compat/allsignal/test/simple
./libs/h2_compat/allsignal/test/trapfails
./libs/h2_compat/anysignal/test/simple
./libs/h2_compat/anysignal/test/trapfails
./libs/h2_compat/error/test/simple
./libs/h2_compat/sem/test/simple
./libs/h2_compat/sleep/test
./libs/h2/vmtraps/test/test_ie
./libs/h2/vmtraps/test/test_pcycles
./libs/h2/vmtraps/test/test_return
./libs/h2/vmtraps/test/test_yield

./perf/setie
Expand Down
9 changes: 4 additions & 5 deletions scripts/testlist.v81
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
./kernel/mem/tlbmisc/test
./kernel/mem/tlbmiss/test
# ./kernel/mem/varadix/test FIXME: needs to adapt to different kernel page size/count
# ./kernel/power/apcr/test_multi FIXME: needs changes to work with new ${EXEC}_tmp make target
./kernel/power/apcr/test_multi
./kernel/power/hvx/test
#./kernel/power/apcr/simple_test
./kernel/power/apcr/simple_test
./kernel/sched/check_sanity/test/tests/H2K_check_sanity/scenarios
./kernel/sched/dosched/test/test
./kernel/futex/futex/test/tests/badaccess
./kernel/futex/futex/test/tests/find_match
./kernel/futex/futex/test/tests/multi_va
./kernel/futex/futex/test/tests/multi_wake
#./kernel/futex/futex/test/tests/pi # FIXME: timing-dependent fails
./kernel/futex/futex/test/tests/pi
./kernel/futex/futex/test/tests/simple_lock_unlock
./kernel/sched/lowprio/test
./kernel/sched/resched/test
Expand Down Expand Up @@ -90,9 +90,8 @@
./libs/h2_compat/error/test/simple
./libs/h2_compat/sem/test/simple
./libs/h2_compat/sleep/test

./libs/h2/vmtraps/test/test_ie
#./libs/h2/vmtraps/test/test_pcycles
./libs/h2/vmtraps/test/test_pcycles
./libs/h2/vmtraps/test/test_return
./libs/h2/vmtraps/test/test_yield

Expand Down
Loading