mirror of
https://github.com/drasko/codezero.git
synced 2026-01-13 03:13:15 +01:00
Test container type is added.
Test container is planned to test codezero microkernel extensively. With these changes, everything is there to develop a full-featured test suite. It also exemplifies how a new container type can be added to the system. (cherry picked from commit f21fa53df421bfc8eeeaa096c89b98beed436c60)
This commit is contained in:
committed by
Bahadir Balban
parent
89d49ef495
commit
2a47e425c4
44
conts/test/SConscript
Normal file
44
conts/test/SConscript
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
Import('config', 'env', 'contid')
|
||||
|
||||
import os, sys
|
||||
from config.projpaths import *
|
||||
|
||||
arch = config.arch
|
||||
|
||||
sys.path.append('../../')
|
||||
from config.lib import *
|
||||
|
||||
container = next((c for c in config.containers if int(c.id) == int(contid)), None)
|
||||
|
||||
CONTAINER_INCLUDE = join(BUILDDIR, 'cont' + str(contid) + '/test' + '/include')
|
||||
|
||||
def generate_linker_script(target, source, env):
|
||||
with open(source[0].path, 'r') as lds_in:
|
||||
linker_script = lds_in.read()
|
||||
with open(target[0].path, 'w+') as lds_out:
|
||||
assert container.pager_vma != 0
|
||||
assert container.pager_lma != 0
|
||||
lds_out.write(linker_script % (conv_hex(container.pager_vma), conv_hex(container.pager_lma)))
|
||||
|
||||
def generate_container_h(target, source, env):
|
||||
with open(source[0].path, 'r') as fin:
|
||||
str = fin.read()
|
||||
with open(target[0].path, 'w+') as fout:
|
||||
# Make any manipulations here
|
||||
fout.write(str % (container.name, container.id, container.id))
|
||||
|
||||
linker_lds = Command('include/linker.lds', 'include/linker.lds.in', generate_linker_script)
|
||||
|
||||
container_h = Command('include/container.h', 'include/container.h.in', generate_container_h)
|
||||
|
||||
src = [Glob('*.[cS]') + Glob('src/*.[cS]')]
|
||||
|
||||
env.Append(LINKFLAGS = ['-T' + linker_lds[0].path, '-u_start'])
|
||||
env.Append(CPPPATH = [CONTAINER_INCLUDE])
|
||||
|
||||
objs = env.Object(src)
|
||||
prog = env.Program('main.elf', objs)
|
||||
Depends(linker_lds, CML2_CONFIG_H)
|
||||
Depends(prog, linker_lds)
|
||||
|
||||
Reference in New Issue
Block a user