nasmtests: generate single executable for both test and reference
This commit is contained in:
parent
a11eb20326
commit
d766863a27
|
@ -2,24 +2,19 @@ source_files := $(wildcard build/*.asm)
|
|||
source_files += $(addprefix build/,$(wildcard *.asm))
|
||||
|
||||
obj_files := $(patsubst %.asm,%.o,$(source_files))
|
||||
host_executables := $(patsubst %.asm,%.bin,$(source_files))
|
||||
v86_executables := $(patsubst %.asm,%.img,$(source_files))
|
||||
|
||||
inc_files := $(addprefix build/,$(wildcard *.inc))
|
||||
|
||||
all: $(source_files) $(obj_files) $(inc_files) $(host_executables) $(v86_executables)
|
||||
all: $(source_files) $(obj_files) $(inc_files) $(v86_executables)
|
||||
.PHONY: all
|
||||
|
||||
build/%.o: build/%.asm $(inc_files)
|
||||
nasm -w+error -felf32 -o $@ $<
|
||||
|
||||
# To run / debug locally
|
||||
build/%.bin: build/%.o
|
||||
ld -g $< -m elf_i386 --section-start=.bss=0x100000 --section-start=.text=0x800000 -o $@
|
||||
|
||||
# To use as a multiboot kernel image for v86
|
||||
# used both as a multiboot image for v86 and as a regular elf executable for gdb
|
||||
build/%.img: build/%.o
|
||||
ld -g $< -m elf_i386 --section-start=.bss=0x100000 --section-start=.text=0x8000 --section-start=.multiboot=0x200 -o $@
|
||||
ld -g $< -m elf_i386 --section-start=.bss=0x100000 --section-start=.text=0x80000 --section-start=.multiboot=0x20000 -o $@
|
||||
|
||||
build/%.asm: %.asm
|
||||
mkdir -p build; cp $< $@
|
||||
|
|
|
@ -59,11 +59,11 @@ assert(
|
|||
|
||||
const dir_files = fs.readdirSync(BUILD_DIR);
|
||||
const test_files = dir_files.filter(name => {
|
||||
return name.endsWith(".bin");
|
||||
return name.endsWith(".img");
|
||||
}).map(name => {
|
||||
return name.slice(0, -4);
|
||||
}).filter(name => {
|
||||
const bin_file = path.join(BUILD_DIR, `${name}.bin`);
|
||||
const bin_file = path.join(BUILD_DIR, `${name}.img`);
|
||||
const fixture_file = path.join(BUILD_DIR, `${name}.fixture`);
|
||||
if(!fs.existsSync(fixture_file))
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ function test_arg_formatter(workload)
|
|||
{
|
||||
return workload.map(test => {
|
||||
const test_path = path.join(BUILD_DIR, test);
|
||||
return `--eval-command=extract-state ${test_path}.bin ${test_path}.fixture`;
|
||||
return `--eval-command=extract-state ${test_path}.img ${test_path}.fixture`;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -32,10 +32,6 @@ const TERMINATE_MSG = "DONE";
|
|||
|
||||
const FORCE_JIT = process.argv.includes("--force-jit");
|
||||
|
||||
// see --section-start= in makefile
|
||||
const V86_TEXT_OFFSET = 0x8000;
|
||||
const NASM_TEXT_OFFSET = 0x800000;
|
||||
|
||||
// alternative representation for infinity for json
|
||||
const JSON_POS_INFINITY = "+INFINITY";
|
||||
const JSON_NEG_INFINITY = "-INFINITY";
|
||||
|
@ -479,12 +475,12 @@ else {
|
|||
if(current_test.fixture.exception)
|
||||
{
|
||||
const seen_eip = (recorded_exceptions[0] || {}).eip;
|
||||
if(seen_eip - V86_TEXT_OFFSET !== expected_eip - NASM_TEXT_OFFSET)
|
||||
if(seen_eip !== expected_eip)
|
||||
{
|
||||
individual_failures.push({
|
||||
name: "exception eip",
|
||||
expected: expected_eip - NASM_TEXT_OFFSET,
|
||||
actual: seen_eip === undefined ? "(none)" : seen_eip - V86_TEXT_OFFSET,
|
||||
expected: expected_eip,
|
||||
actual: seen_eip === undefined ? "(none)" : seen_eip,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue