Initial commit
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
#
|
||||
# Simple Test Makefile
|
||||
# Mike Lam, James Madison University, August 2016
|
||||
#
|
||||
# This version of the Makefile includes support for building a test suite. The
|
||||
# recommended framework is Check (http://check.sourceforge.net/). To build and
|
||||
# run the test suite, execute the "test" target. The test suite must be located
|
||||
# in a module called "testsuite". The MODS, LIBS, and OBJS variables work as
|
||||
# they do in the main Makefile.
|
||||
#
|
||||
# To change the default build target (which executes when you just type
|
||||
# "make"), change the right-hand side of the definition of the "default"
|
||||
# target.
|
||||
#
|
||||
# By default, this makefile will build the project with debugging symbols and
|
||||
# without optimization. To change this, edit or remove the "-g" and "-O0"
|
||||
# options in CFLAGS and LDFLAGS accordingly.
|
||||
#
|
||||
# By default, this makefile build the application using the GNU C compiler,
|
||||
# adhering to the C99 standard with all warnings enabled.
|
||||
|
||||
|
||||
# application-specific settings and run target
|
||||
|
||||
EXE=../y86
|
||||
TEST=testsuite
|
||||
MODS=public.o
|
||||
OBJS=../p1-check.o ../p2-load.o ../p3-disas.o private.o
|
||||
LIBS=
|
||||
|
||||
UTESTOUT=utests.txt
|
||||
ITESTOUT=itests.txt
|
||||
|
||||
default: $(TEST)
|
||||
|
||||
$(EXE):
|
||||
make -C ../
|
||||
|
||||
test: utest itest
|
||||
@echo "========================================"
|
||||
|
||||
utest: $(EXE) $(TEST)
|
||||
@echo "========================================"
|
||||
@echo " UNIT TESTS"
|
||||
@./$(TEST) 2>/dev/null >$(UTESTOUT)
|
||||
@cat $(UTESTOUT) | sed -n -e '/Checks/,$$p' | sed -e 's/^private.*:[EF]://g'
|
||||
|
||||
itest: $(EXE)
|
||||
@echo "========================================"
|
||||
@echo " INTEGRATION TESTS"
|
||||
@./integration.sh | tee $(ITESTOUT)
|
||||
|
||||
|
||||
# compiler/linker settings
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-g -O0 -Wall --std=c99 -pedantic
|
||||
LDFLAGS=-g -O0
|
||||
|
||||
CFLAGS+=-I/opt/homebrew/include -Wno-gnu-zero-variadic-macro-arguments
|
||||
LDFLAGS+=-L/opt/homebrew/lib
|
||||
LIBS+=-lcheck -lm -lpthread
|
||||
|
||||
ifeq ($(shell uname -s),Linux)
|
||||
LIBS+=-lrt -lsubunit
|
||||
endif
|
||||
|
||||
|
||||
# build targets
|
||||
|
||||
$(TEST): $(TEST).o $(MODS) $(OBJS)
|
||||
$(CC) $(LDFLAGS) -o $(TEST) $^ $(LIBS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
clean:
|
||||
rm -rf $(TEST) $(TEST).o $(MODS) $(UTESTOUT) $(ITESTOUT) outputs valgrind
|
||||
|
||||
.PHONY: default clean test unittest inttest
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Failed to read file
|
||||
@@ -0,0 +1 @@
|
||||
Failed to read file
|
||||
@@ -0,0 +1 @@
|
||||
Failed to read file
|
||||
@@ -0,0 +1 @@
|
||||
Failed to read file
|
||||
@@ -0,0 +1 @@
|
||||
Failed to read file
|
||||
@@ -0,0 +1,6 @@
|
||||
Disassembly of data contents:
|
||||
0x200: | .pos 0x200 data
|
||||
0x200: 88 77 66 55 44 33 22 11 | .quad 0x1122334455667788
|
||||
0x208: 78 56 34 12 00 00 00 00 | .quad 0x12345678
|
||||
0x210: 42 00 00 00 00 00 00 00 | .quad 0x42
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 00 | halt
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Usage: ../y86 <option(s)> mini-elf-file
|
||||
Options are:
|
||||
-h Display usage
|
||||
-H Show the Mini-ELF header
|
||||
-a Show all with brief memory
|
||||
-f Show all with full memory
|
||||
-s Show the program headers
|
||||
-m Show the memory contents (brief)
|
||||
-M Show the memory contents (full)
|
||||
-d Disassemble code contents
|
||||
-D Disassemble data contents
|
||||
@@ -0,0 +1,22 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 00 | halt
|
||||
|
||||
0x400: | .pos 0x400 code
|
||||
0x400: 10 | nop
|
||||
0x401: 00 | halt
|
||||
|
||||
Disassembly of data contents:
|
||||
0x200: | .pos 0x200 data
|
||||
0x200: 10 00 00 00 00 00 00 00 | .quad 0x10
|
||||
|
||||
0x300: | .pos 0x300 rodata
|
||||
0x300: 74 65 73 74 00 | .string "test"
|
||||
|
||||
0x500: | .pos 0x500 data
|
||||
0x500: 78 56 34 12 00 00 00 00 | .quad 0x12345678
|
||||
|
||||
0x600: | .pos 0x600 rodata
|
||||
0x600: 61 67 61 69 6e 00 | .string "again"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 30 f3 0f 00 00 00 20 31 40 13 | irmovq 0x134031200000000f, %rbx
|
||||
Invalid opcode: 0xfd
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Usage: ../y86 <option(s)> mini-elf-file
|
||||
Options are:
|
||||
-h Display usage
|
||||
-H Show the Mini-ELF header
|
||||
-a Show all with brief memory
|
||||
-f Show all with full memory
|
||||
-s Show the program headers
|
||||
-m Show the memory contents (brief)
|
||||
-M Show the memory contents (full)
|
||||
-d Disassemble code contents
|
||||
-D Disassemble data contents
|
||||
@@ -0,0 +1,4 @@
|
||||
Disassembly of data contents:
|
||||
0x200: | .pos 0x200 rodata
|
||||
0x200: 68 65 6c 6c 6f 00 | .string "hello"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 00 | halt
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
Disassembly of data contents:
|
||||
0x200: | .pos 0x200 rodata
|
||||
0x200: 30 31 32 33 34 35 36 37 38 39 | .string "0123456789"
|
||||
0x20a: 00 |
|
||||
0x20b: 68 65 6c 6c 6f 20 77 6f 72 6c | .string "hello world"
|
||||
0x215: 64 00 |
|
||||
0x217: 61 62 63 64 65 66 67 68 69 6a | .string "abcdefghijklmnopqrstuvwxyz"
|
||||
0x221: 6b 6c 6d 6e 6f 70 71 72 73 74 |
|
||||
0x22b: 75 76 77 78 79 7a 00 |
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Disassembly of data contents:
|
||||
0x200: | .pos 0x200 rodata
|
||||
0x200: 66 6f 6f 00 | .string "foo"
|
||||
0x204: 77 30 30 74 00 | .string "w00t"
|
||||
0x209: 75 70 20 64 6f 77 6e 00 | .string "up down"
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
Disassembly of data contents:
|
||||
0x200: | .pos 0x200 rodata
|
||||
0x200: 54 6f 20 62 65 2c 20 6f 72 20 | .string "To be, or not to be: that is the question"
|
||||
0x20a: 6e 6f 74 20 74 6f 20 62 65 3a |
|
||||
0x214: 20 74 68 61 74 20 69 73 20 74 |
|
||||
0x21e: 68 65 20 71 75 65 73 74 69 6f |
|
||||
0x228: 6e 00 |
|
||||
0x22a: 57 68 61 74 27 73 20 69 6e 20 | .string "What's in a name? A rose by any other name would smell as sweet."
|
||||
0x234: 61 20 6e 61 6d 65 3f 20 41 20 |
|
||||
0x23e: 72 6f 73 65 20 62 79 20 61 6e |
|
||||
0x248: 79 20 6f 74 68 65 72 20 6e 61 |
|
||||
0x252: 6d 65 20 77 6f 75 6c 64 20 73 |
|
||||
0x25c: 6d 65 6c 6c 20 61 73 20 73 77 |
|
||||
0x266: 65 65 74 2e 00 |
|
||||
0x26b: 42 75 74 2c 20 66 6f 72 20 6d | .string "But, for my own part, it was Greek to me."
|
||||
0x275: 79 20 6f 77 6e 20 70 61 72 74 |
|
||||
0x27f: 2c 20 69 74 20 77 61 73 20 47 |
|
||||
0x289: 72 65 65 6b 20 74 6f 20 6d 65 |
|
||||
0x293: 2e 00 |
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
01 00 18 01 10 00 03 00 00 00 00 00 45 4c 46 00
|
||||
Mini-ELF version 1
|
||||
Entry point 0x118
|
||||
There are 3 program headers, starting at offset 16 (0x10)
|
||||
There is no symbol table present
|
||||
There is no string table present
|
||||
Segment Offset Size VirtAddr Type Flags
|
||||
00 0x004c 0x0009 0x0000 CODE R X
|
||||
01 0x0055 0x0002 0x0118 CODE R X
|
||||
02 0x0057 0x0008 0x013a DATA RW
|
||||
Contents of memory from 0000 to 0009:
|
||||
0000 70 18 01 00 00 00 00 00 00
|
||||
Contents of memory from 0118 to 011a:
|
||||
0110 10 00
|
||||
Contents of memory from 013a to 0142:
|
||||
0130 39 30 00 00 00 00
|
||||
0140 00 00
|
||||
Disassembly of executable contents:
|
||||
0x000: | .pos 0x000 code
|
||||
0x000: 70 18 01 00 00 00 00 00 00 | jmp 0x118
|
||||
|
||||
0x118: | .pos 0x118 code
|
||||
0x118: | _start:
|
||||
0x118: 10 | nop
|
||||
0x119: 00 | halt
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
01 00 55 05 10 00 03 00 00 00 00 00 45 4c 46 00
|
||||
Mini-ELF version 1
|
||||
Entry point 0x555
|
||||
There are 3 program headers, starting at offset 16 (0x10)
|
||||
There is no symbol table present
|
||||
There is no string table present
|
||||
Segment Offset Size VirtAddr Type Flags
|
||||
00 0x004c 0x0009 0x0000 CODE R X
|
||||
01 0x0055 0x001f 0x0555 CODE R X
|
||||
02 0x0074 0x0008 0x0987 DATA RW
|
||||
Contents of memory from 0000 to 0009:
|
||||
0000 70 55 05 00 00 00 00 00 00
|
||||
Contents of memory from 0555 to 0574:
|
||||
0550 30 f0 4d 01 00 00 00 00 00 00 30
|
||||
0560 f3 de 00 00 00 00 00 00 00 30 f1 6f 00 00 00 00
|
||||
0570 00 00 00 00
|
||||
Contents of memory from 0987 to 098f:
|
||||
0980 dd cc bb aa 00 00 00 00
|
||||
Disassembly of executable contents:
|
||||
0x000: | .pos 0x000 code
|
||||
0x000: 70 55 05 00 00 00 00 00 00 | jmp 0x555
|
||||
|
||||
0x555: | .pos 0x555 code
|
||||
0x555: | _start:
|
||||
0x555: 30 f0 4d 01 00 00 00 00 00 00 | irmovq 0x14d, %rax
|
||||
0x55f: 30 f3 de 00 00 00 00 00 00 00 | irmovq 0xde, %rbx
|
||||
0x569: 30 f1 6f 00 00 00 00 00 00 00 | irmovq 0x6f, %rcx
|
||||
0x573: 00 | halt
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: c0 | iotrap 0
|
||||
0x101: c1 | iotrap 1
|
||||
0x102: c2 | iotrap 2
|
||||
0x103: c3 | iotrap 3
|
||||
0x104: c4 | iotrap 4
|
||||
0x105: c5 | iotrap 5
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 70 88 77 66 55 44 33 22 11 | jmp 0x1122334455667788
|
||||
0x109: 71 77 66 55 44 33 22 11 88 | jle 0x8811223344556677
|
||||
0x112: 72 66 55 44 33 22 11 88 77 | jl 0x7788112233445566
|
||||
0x11b: 73 55 44 33 22 11 88 77 66 | je 0x6677881122334455
|
||||
0x124: 74 44 33 22 11 88 77 66 55 | jne 0x5566778811223344
|
||||
0x12d: 75 33 22 11 88 77 66 55 44 | jge 0x4455667788112233
|
||||
0x136: 76 22 11 88 77 66 55 44 33 | jg 0x3344556677881122
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 70 88 77 66 55 44 33 22 11 | jmp 0x1122334455667788
|
||||
0x109: 80 11 22 33 44 55 66 77 88 | call 0x8877665544332211
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
01 00 00 01 10 00 01 00 00 00 00 00 45 4c 46 00
|
||||
Mini-ELF version 1
|
||||
Entry point 0x100
|
||||
There are 1 program headers, starting at offset 16 (0x10)
|
||||
There is no symbol table present
|
||||
There is no string table present
|
||||
Segment Offset Size VirtAddr Type Flags
|
||||
00 0x0024 0x0017 0x0100 CODE R X
|
||||
Contents of memory from 0100 to 0117:
|
||||
0100 30 f0 68 24 00 00 00 00 00 00 30 f3 34 12 00 00
|
||||
0110 00 00 00 00 60 03 00
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 30 f0 68 24 00 00 00 00 00 00 | irmovq 0x2468, %rax
|
||||
0x10a: 30 f3 34 12 00 00 00 00 00 00 | irmovq 0x1234, %rbx
|
||||
0x114: 60 03 | addq %rax, %rbx
|
||||
0x116: 00 | halt
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: 10 | nop
|
||||
0x101: 10 | nop
|
||||
0x102: 10 | nop
|
||||
0x103: | _start:
|
||||
0x103: 30 f0 68 24 00 00 00 00 00 00 | irmovq 0x2468, %rax
|
||||
0x10d: 30 f3 34 12 00 00 00 00 00 00 | irmovq 0x1234, %rbx
|
||||
0x117: 60 03 | addq %rax, %rbx
|
||||
0x119: 70 00 02 00 00 00 00 00 00 | jmp 0x200
|
||||
|
||||
0x200: | .pos 0x200 code
|
||||
0x200: 30 f1 78 56 00 00 00 00 00 00 | irmovq 0x5678, %rcx
|
||||
0x20a: 30 f2 14 15 00 00 00 00 00 00 | irmovq 0x1514, %rdx
|
||||
0x214: 61 21 | subq %rdx, %rcx
|
||||
0x216: 00 | halt
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 30 f0 88 77 66 55 44 33 22 11 | irmovq 0x1122334455667788, %rax
|
||||
0x10a: 40 12 21 43 65 87 78 56 34 12 | rmmovq %rcx, 0x1234567887654321(%rdx)
|
||||
0x114: 50 12 78 56 34 12 21 43 65 87 | mrmovq 0x8765432112345678(%rdx), %rcx
|
||||
0x11e: 40 1f 21 43 65 87 78 56 34 12 | rmmovq %rcx, 0x1234567887654321
|
||||
0x128: 50 1f 78 56 34 12 21 43 65 87 | mrmovq 0x8765432112345678, %rcx
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 20 01 | rrmovq %rax, %rcx
|
||||
0x102: 21 23 | cmovle %rdx, %rbx
|
||||
0x104: 22 45 | cmovl %rsp, %rbp
|
||||
0x106: 23 67 | cmove %rsi, %rdi
|
||||
0x108: 24 89 | cmovne %r8, %r9
|
||||
0x10a: 25 ab | cmovge %r10, %r11
|
||||
0x10c: 26 ce | cmovg %r12, %r14
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Usage: ../y86 <option(s)> mini-elf-file
|
||||
Options are:
|
||||
-h Display usage
|
||||
-H Show the Mini-ELF header
|
||||
-a Show all with brief memory
|
||||
-f Show all with full memory
|
||||
-s Show the program headers
|
||||
-m Show the memory contents (brief)
|
||||
-M Show the memory contents (full)
|
||||
-d Disassemble code contents
|
||||
-D Disassemble data contents
|
||||
@@ -0,0 +1,8 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 60 23 | addq %rdx, %rbx
|
||||
0x102: 61 01 | subq %rax, %rcx
|
||||
0x104: 62 45 | andq %rsp, %rbp
|
||||
0x106: 63 67 | xorq %rsi, %rdi
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 20 01 | rrmovq %rax, %rcx
|
||||
0x102: 60 23 | addq %rdx, %rbx
|
||||
0x104: a0 6f | pushq %rsi
|
||||
0x106: b0 7f | popq %rdi
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 00 | halt
|
||||
0x101: 10 | nop
|
||||
0x102: 90 | ret
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,87 @@
|
||||
#!/bin/bash
|
||||
|
||||
# extract executable name from Makefile
|
||||
EXE=$(grep "EXE=" Makefile | sed -e "s/EXE=//")
|
||||
|
||||
# detect timeout utility (i.e., "timeout" on Linux and "gtimeout" on MacOS)
|
||||
# and set timeout interval
|
||||
TIMEOUT="timeout"
|
||||
TIMEOUT_INTERVAL="3s"
|
||||
$TIMEOUT --help &>/dev/null
|
||||
if [[ $? -ne 0 ]]; then
|
||||
TIMEOUT="gtimeout"
|
||||
fi
|
||||
|
||||
# Valgrind additional output flags
|
||||
VG_FLAGS="--leak-check=full --track-origins=yes"
|
||||
|
||||
function run_test {
|
||||
|
||||
# parameters
|
||||
TAG=$1
|
||||
ARGS=$2
|
||||
PTAG=$(printf '%-30s' "$TAG")
|
||||
|
||||
# file paths
|
||||
OUTPUT=outputs/$TAG.txt
|
||||
DIFF=outputs/$TAG.diff
|
||||
EXPECT=expected/$TAG.txt
|
||||
VALGRND=valgrind/$TAG.txt
|
||||
|
||||
# run test with timeout
|
||||
$TIMEOUT $TIMEOUT_INTERVAL $EXE $ARGS 2>/dev/null >"$OUTPUT"
|
||||
if [ "$?" -lt 124 ]; then
|
||||
|
||||
# no timeout; compare output to the expected version
|
||||
diff -u "$OUTPUT" "$EXPECT" >"$DIFF"
|
||||
if [ -s "$DIFF" ]; then
|
||||
|
||||
# try alternative solution (if it exists)
|
||||
EXPECT=expected/$TAG-2.txt
|
||||
if [ -e "$EXPECT" ]; then
|
||||
diff -u "$OUTPUT" "$EXPECT" >"$DIFF"
|
||||
if [ -s "$DIFF" ]; then
|
||||
echo "$PTAG FAIL (see ${TPREFIX}$DIFF for details)"
|
||||
else
|
||||
echo "$PTAG pass"
|
||||
fi
|
||||
else
|
||||
echo "$PTAG FAIL (see ${TPREFIX}$DIFF for details)"
|
||||
fi
|
||||
else
|
||||
echo "$PTAG pass"
|
||||
fi
|
||||
|
||||
# run valgrind
|
||||
$TIMEOUT $TIMEOUT_INTERVAL valgrind $VG_FLAGS $EXE $ARGS &>$VALGRND
|
||||
else
|
||||
echo "$PTAG FAIL (crash or timeout)"
|
||||
fi
|
||||
}
|
||||
|
||||
# initialize output folders
|
||||
mkdir -p outputs
|
||||
mkdir -p valgrind
|
||||
rm -f outputs/* valgrind/*
|
||||
|
||||
# run individual tests
|
||||
source itests.include
|
||||
|
||||
# check for memory leaks
|
||||
LEAK=`cat valgrind/*.txt | grep 'definitely lost' | grep -v ' 0 bytes in 0 blocks'`
|
||||
if [ -z "$LEAK" ]; then
|
||||
echo "No memory leak found."
|
||||
else
|
||||
echo "Memory leak(s) found. See files listed below for details."
|
||||
grep 'definitely lost' valgrind/*.txt | sed -e 's/:.*$//g' | awk "{print \" - ${TPREFIX}\" \$0}"
|
||||
fi
|
||||
|
||||
# check for uninitialized values
|
||||
LEAK=`cat valgrind/*.txt | grep 'uninitialised value'`
|
||||
if [ -z "$LEAK" ]; then
|
||||
echo "No uninitialized value found."
|
||||
else
|
||||
echo "Uninitialized value(s) found. See files listed below for details."
|
||||
grep 'uninitialised value' valgrind/*.txt | sed -e 's/:.*$//g' | awk "{print \" - ${TPREFIX}\" \$0}"
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# list of integration tests
|
||||
# format: run_test <TAG> <ARGS>
|
||||
# <TAG> used as the root for all filenames (i.e., "expected/$TAG.txt")
|
||||
# <ARGS> command-line arguments to test
|
||||
|
||||
run_test D_onebyte "-d inputs/onebyte.o"
|
||||
run_test C_help "-h"
|
||||
run_test C_twobyte "-d inputs/twobyte.o"
|
||||
run_test C_cmov "-d inputs/cmov.o"
|
||||
run_test C_opq "-d inputs/opq.o"
|
||||
run_test B_ninebyte "-d inputs/ninebyte.o"
|
||||
run_test B_jmp "-d inputs/jmp.o"
|
||||
run_test B_tenbyte "-d inputs/tenbyte.o"
|
||||
run_test B_simple "-a -d inputs/simple.o"
|
||||
run_test B_simple_multi "-d inputs/simple_multi.o"
|
||||
run_test B_iotrap "-d inputs/iotrap.o"
|
||||
run_test A_data_code "-d inputs/data.o"
|
||||
run_test A_rodata_code "-d inputs/rodata.o"
|
||||
run_test A_data "-D inputs/data.o"
|
||||
run_test A_rodata "-D inputs/rodata.o"
|
||||
run_test A_rodata_multi "-D inputs/rodata_multi.o"
|
||||
run_test A_interleaved "-d -D inputs/interleaved.o"
|
||||
run_test A_invalid "-d inputs/invalid.o"
|
||||
run_test A_bad_no_elf "-d inputs/bad-no_elf.o"
|
||||
run_test A_bad_phdr "-d inputs/bad-phdr.o"
|
||||
run_test A_bad_short_header "-d inputs/bad-short_header.o"
|
||||
run_test A_bad_short_phdr "-d inputs/bad-short_phdr.o"
|
||||
run_test A_bad_filename "-d inputs/bad-nonexist.o"
|
||||
run_test A_missing_file "-d"
|
||||
run_test A_extra_params "-d inputs/onebyte.o extra params"
|
||||
run_test A_unaligned1 "-a -d inputs/unaligned.o"
|
||||
run_test A_unaligned2 "-a -d inputs/unaligned2.o"
|
||||
run_test A_rodata_long "-D inputs/rodata_long.o"
|
||||
run_test A_rodata_shakespeare "-D inputs/rodata_shakespeare.o"
|
||||
@@ -0,0 +1,31 @@
|
||||
D_onebyte pass
|
||||
C_help pass
|
||||
C_twobyte pass
|
||||
C_cmov pass
|
||||
C_opq pass
|
||||
B_ninebyte pass
|
||||
B_jmp pass
|
||||
B_tenbyte pass
|
||||
B_simple pass
|
||||
B_simple_multi pass
|
||||
B_iotrap pass
|
||||
A_data_code pass
|
||||
A_rodata_code pass
|
||||
A_data pass
|
||||
A_rodata pass
|
||||
A_rodata_multi pass
|
||||
A_interleaved pass
|
||||
A_invalid pass
|
||||
A_bad_no_elf pass
|
||||
A_bad_phdr pass
|
||||
A_bad_short_header pass
|
||||
A_bad_short_phdr pass
|
||||
A_bad_filename pass
|
||||
A_missing_file pass
|
||||
A_extra_params pass
|
||||
A_unaligned1 pass
|
||||
A_unaligned2 pass
|
||||
A_rodata_long pass
|
||||
A_rodata_shakespeare pass
|
||||
No memory leak found.
|
||||
No uninitialized value found.
|
||||
@@ -0,0 +1 @@
|
||||
Failed to read file
|
||||
@@ -0,0 +1 @@
|
||||
Failed to read file
|
||||
@@ -0,0 +1 @@
|
||||
Failed to read file
|
||||
@@ -0,0 +1 @@
|
||||
Failed to read file
|
||||
@@ -0,0 +1 @@
|
||||
Failed to read file
|
||||
@@ -0,0 +1,6 @@
|
||||
Disassembly of data contents:
|
||||
0x200: | .pos 0x200 data
|
||||
0x200: 88 77 66 55 44 33 22 11 | .quad 0x1122334455667788
|
||||
0x208: 78 56 34 12 00 00 00 00 | .quad 0x12345678
|
||||
0x210: 42 00 00 00 00 00 00 00 | .quad 0x42
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 00 | halt
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Usage: ../y86 <option(s)> mini-elf-file
|
||||
Options are:
|
||||
-h Display usage
|
||||
-H Show the Mini-ELF header
|
||||
-a Show all with brief memory
|
||||
-f Show all with full memory
|
||||
-s Show the program headers
|
||||
-m Show the memory contents (brief)
|
||||
-M Show the memory contents (full)
|
||||
-d Disassemble code contents
|
||||
-D Disassemble data contents
|
||||
@@ -0,0 +1,22 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 00 | halt
|
||||
|
||||
0x400: | .pos 0x400 code
|
||||
0x400: 10 | nop
|
||||
0x401: 00 | halt
|
||||
|
||||
Disassembly of data contents:
|
||||
0x200: | .pos 0x200 data
|
||||
0x200: 10 00 00 00 00 00 00 00 | .quad 0x10
|
||||
|
||||
0x300: | .pos 0x300 rodata
|
||||
0x300: 74 65 73 74 00 | .string "test"
|
||||
|
||||
0x500: | .pos 0x500 data
|
||||
0x500: 78 56 34 12 00 00 00 00 | .quad 0x12345678
|
||||
|
||||
0x600: | .pos 0x600 rodata
|
||||
0x600: 61 67 61 69 6e 00 | .string "again"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 30 f3 0f 00 00 00 20 31 40 13 | irmovq 0x134031200000000f, %rbx
|
||||
Invalid opcode: 0xfd
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Usage: ../y86 <option(s)> mini-elf-file
|
||||
Options are:
|
||||
-h Display usage
|
||||
-H Show the Mini-ELF header
|
||||
-a Show all with brief memory
|
||||
-f Show all with full memory
|
||||
-s Show the program headers
|
||||
-m Show the memory contents (brief)
|
||||
-M Show the memory contents (full)
|
||||
-d Disassemble code contents
|
||||
-D Disassemble data contents
|
||||
@@ -0,0 +1,4 @@
|
||||
Disassembly of data contents:
|
||||
0x200: | .pos 0x200 rodata
|
||||
0x200: 68 65 6c 6c 6f 00 | .string "hello"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 00 | halt
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
Disassembly of data contents:
|
||||
0x200: | .pos 0x200 rodata
|
||||
0x200: 30 31 32 33 34 35 36 37 38 39 | .string "0123456789"
|
||||
0x20a: 00 |
|
||||
0x20b: 68 65 6c 6c 6f 20 77 6f 72 6c | .string "hello world"
|
||||
0x215: 64 00 |
|
||||
0x217: 61 62 63 64 65 66 67 68 69 6a | .string "abcdefghijklmnopqrstuvwxyz"
|
||||
0x221: 6b 6c 6d 6e 6f 70 71 72 73 74 |
|
||||
0x22b: 75 76 77 78 79 7a 00 |
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Disassembly of data contents:
|
||||
0x200: | .pos 0x200 rodata
|
||||
0x200: 66 6f 6f 00 | .string "foo"
|
||||
0x204: 77 30 30 74 00 | .string "w00t"
|
||||
0x209: 75 70 20 64 6f 77 6e 00 | .string "up down"
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
Disassembly of data contents:
|
||||
0x200: | .pos 0x200 rodata
|
||||
0x200: 54 6f 20 62 65 2c 20 6f 72 20 | .string "To be, or not to be: that is the question"
|
||||
0x20a: 6e 6f 74 20 74 6f 20 62 65 3a |
|
||||
0x214: 20 74 68 61 74 20 69 73 20 74 |
|
||||
0x21e: 68 65 20 71 75 65 73 74 69 6f |
|
||||
0x228: 6e 00 |
|
||||
0x22a: 57 68 61 74 27 73 20 69 6e 20 | .string "What's in a name? A rose by any other name would smell as sweet."
|
||||
0x234: 61 20 6e 61 6d 65 3f 20 41 20 |
|
||||
0x23e: 72 6f 73 65 20 62 79 20 61 6e |
|
||||
0x248: 79 20 6f 74 68 65 72 20 6e 61 |
|
||||
0x252: 6d 65 20 77 6f 75 6c 64 20 73 |
|
||||
0x25c: 6d 65 6c 6c 20 61 73 20 73 77 |
|
||||
0x266: 65 65 74 2e 00 |
|
||||
0x26b: 42 75 74 2c 20 66 6f 72 20 6d | .string "But, for my own part, it was Greek to me."
|
||||
0x275: 79 20 6f 77 6e 20 70 61 72 74 |
|
||||
0x27f: 2c 20 69 74 20 77 61 73 20 47 |
|
||||
0x289: 72 65 65 6b 20 74 6f 20 6d 65 |
|
||||
0x293: 2e 00 |
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
01 00 18 01 10 00 03 00 00 00 00 00 45 4c 46 00
|
||||
Mini-ELF version 1
|
||||
Entry point 0x118
|
||||
There are 3 program headers, starting at offset 16 (0x10)
|
||||
There is no symbol table present
|
||||
There is no string table present
|
||||
Segment Offset Size VirtAddr Type Flags
|
||||
00 0x004c 0x0009 0x0000 CODE R X
|
||||
01 0x0055 0x0002 0x0118 CODE R X
|
||||
02 0x0057 0x0008 0x013a DATA RW
|
||||
Contents of memory from 0000 to 0009:
|
||||
0000 70 18 01 00 00 00 00 00 00
|
||||
Contents of memory from 0118 to 011a:
|
||||
0110 10 00
|
||||
Contents of memory from 013a to 0142:
|
||||
0130 39 30 00 00 00 00
|
||||
0140 00 00
|
||||
Disassembly of executable contents:
|
||||
0x000: | .pos 0x000 code
|
||||
0x000: 70 18 01 00 00 00 00 00 00 | jmp 0x118
|
||||
|
||||
0x118: | .pos 0x118 code
|
||||
0x118: | _start:
|
||||
0x118: 10 | nop
|
||||
0x119: 00 | halt
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
01 00 55 05 10 00 03 00 00 00 00 00 45 4c 46 00
|
||||
Mini-ELF version 1
|
||||
Entry point 0x555
|
||||
There are 3 program headers, starting at offset 16 (0x10)
|
||||
There is no symbol table present
|
||||
There is no string table present
|
||||
Segment Offset Size VirtAddr Type Flags
|
||||
00 0x004c 0x0009 0x0000 CODE R X
|
||||
01 0x0055 0x001f 0x0555 CODE R X
|
||||
02 0x0074 0x0008 0x0987 DATA RW
|
||||
Contents of memory from 0000 to 0009:
|
||||
0000 70 55 05 00 00 00 00 00 00
|
||||
Contents of memory from 0555 to 0574:
|
||||
0550 30 f0 4d 01 00 00 00 00 00 00 30
|
||||
0560 f3 de 00 00 00 00 00 00 00 30 f1 6f 00 00 00 00
|
||||
0570 00 00 00 00
|
||||
Contents of memory from 0987 to 098f:
|
||||
0980 dd cc bb aa 00 00 00 00
|
||||
Disassembly of executable contents:
|
||||
0x000: | .pos 0x000 code
|
||||
0x000: 70 55 05 00 00 00 00 00 00 | jmp 0x555
|
||||
|
||||
0x555: | .pos 0x555 code
|
||||
0x555: | _start:
|
||||
0x555: 30 f0 4d 01 00 00 00 00 00 00 | irmovq 0x14d, %rax
|
||||
0x55f: 30 f3 de 00 00 00 00 00 00 00 | irmovq 0xde, %rbx
|
||||
0x569: 30 f1 6f 00 00 00 00 00 00 00 | irmovq 0x6f, %rcx
|
||||
0x573: 00 | halt
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: c0 | iotrap 0
|
||||
0x101: c1 | iotrap 1
|
||||
0x102: c2 | iotrap 2
|
||||
0x103: c3 | iotrap 3
|
||||
0x104: c4 | iotrap 4
|
||||
0x105: c5 | iotrap 5
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 70 88 77 66 55 44 33 22 11 | jmp 0x1122334455667788
|
||||
0x109: 71 77 66 55 44 33 22 11 88 | jle 0x8811223344556677
|
||||
0x112: 72 66 55 44 33 22 11 88 77 | jl 0x7788112233445566
|
||||
0x11b: 73 55 44 33 22 11 88 77 66 | je 0x6677881122334455
|
||||
0x124: 74 44 33 22 11 88 77 66 55 | jne 0x5566778811223344
|
||||
0x12d: 75 33 22 11 88 77 66 55 44 | jge 0x4455667788112233
|
||||
0x136: 76 22 11 88 77 66 55 44 33 | jg 0x3344556677881122
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 70 88 77 66 55 44 33 22 11 | jmp 0x1122334455667788
|
||||
0x109: 80 11 22 33 44 55 66 77 88 | call 0x8877665544332211
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
01 00 00 01 10 00 01 00 00 00 00 00 45 4c 46 00
|
||||
Mini-ELF version 1
|
||||
Entry point 0x100
|
||||
There are 1 program headers, starting at offset 16 (0x10)
|
||||
There is no symbol table present
|
||||
There is no string table present
|
||||
Segment Offset Size VirtAddr Type Flags
|
||||
00 0x0024 0x0017 0x0100 CODE R X
|
||||
Contents of memory from 0100 to 0117:
|
||||
0100 30 f0 68 24 00 00 00 00 00 00 30 f3 34 12 00 00
|
||||
0110 00 00 00 00 60 03 00
|
||||
Disassembly of executable contents:
|
||||
0x100: | .pos 0x100 code
|
||||
0x100: | _start:
|
||||
0x100: 30 f0 68 24 00 00 00 00 00 00 | irmovq 0x2468, %rax
|
||||
0x10a: 30 f3 34 12 00 00 00 00 00 00 | irmovq 0x1234, %rbx
|
||||
0x114: 60 03 | addq %rax, %rbx
|
||||
0x116: 00 | halt
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user