diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:16 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:16 -0800 |
commit | 82ea7a177797b844b252effea5c7c7c5d63ea4ac (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /emulator/qtools/tests | |
parent | c9432be76d50a527da232d518f633add2f76242b (diff) | |
download | sdk-82ea7a177797b844b252effea5c7c7c5d63ea4ac.zip sdk-82ea7a177797b844b252effea5c7c7c5d63ea4ac.tar.gz sdk-82ea7a177797b844b252effea5c7c7c5d63ea4ac.tar.bz2 |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'emulator/qtools/tests')
-rw-r--r-- | emulator/qtools/tests/common_head.mk | 25 | ||||
-rw-r--r-- | emulator/qtools/tests/common_tail.mk | 3 | ||||
-rw-r--r-- | emulator/qtools/tests/gtrace/Makefile | 18 | ||||
-rw-r--r-- | emulator/qtools/tests/gtrace/test.c | 201 | ||||
-rw-r--r-- | emulator/qtools/tests/macros.h | 93 | ||||
-rw-r--r-- | emulator/qtools/tests/tests.ld | 10 |
6 files changed, 0 insertions, 350 deletions
diff --git a/emulator/qtools/tests/common_head.mk b/emulator/qtools/tests/common_head.mk deleted file mode 100644 index e8170e9..0000000 --- a/emulator/qtools/tests/common_head.mk +++ /dev/null @@ -1,25 +0,0 @@ -CC := arm-elf-gcc -LD := arm-elf-ld -AS := arm-elf-as -OBJCOPY := arm-elf-objcopy -OBJDUMP := arm-elf-objdump - -OPT := -g -CFLAGS := $(OPT) -mcpu=arm9 - -.SUFFIXES: .dis .bin .elf - -.c.elf: - $(CC) $(CFLAGS) -Xlinker --script ../tests.ld -o $@ $< -nostdlib - -.c.s: - $(CC) $(CFLAGS) -static -S $< - -.S.elf: - $(CC) $(CFLAGS) -Xlinker --script ../tests.ld -nostdlib -o $@ $< - -.elf.dis: - $(OBJDUMP) -adx $< > $@ - -.elf.bin: - $(OBJCOPY) -O binary $< $@ diff --git a/emulator/qtools/tests/common_tail.mk b/emulator/qtools/tests/common_tail.mk deleted file mode 100644 index be1c141..0000000 --- a/emulator/qtools/tests/common_tail.mk +++ /dev/null @@ -1,3 +0,0 @@ - -clean: - rm -f *.elf *.dis *.bin *.o *~ a.out diff --git a/emulator/qtools/tests/gtrace/Makefile b/emulator/qtools/tests/gtrace/Makefile deleted file mode 100644 index 1d2050c..0000000 --- a/emulator/qtools/tests/gtrace/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../common_head.mk - -P4ROOT=/work/android -QEMU=$(P4ROOT)/device/tools/qemu/arm-softmmu/qemu-system-arm -QTOOLS=$(P4ROOT)/device/tools/qtools - -all: test.elf test.bin test.dis - -trace: test.elf test.bin - $(QEMU) -QEMU -kernel test.bin -trace foo - $(QTOOLS)/post_trace foo - $(QTOOLS)/read_trace foo test.elf > t1 - -gtrace: trace - $(QTOOLS)/q2g -r $(P4ROOT)/device/out/linux-arm-release/symbols foo test.elf foo.gtrace - gtracepost64 foo.gtrace > t2 - -include ../common_tail.mk diff --git a/emulator/qtools/tests/gtrace/test.c b/emulator/qtools/tests/gtrace/test.c deleted file mode 100644 index e56a0f1..0000000 --- a/emulator/qtools/tests/gtrace/test.c +++ /dev/null @@ -1,201 +0,0 @@ -#include "../macros.h" - -int foo1(); -int foo2(); -void bar(); -int child1(); -int child2(); -int child3(); -int child4(); -int child5(); - -int global; - -void start() -{ - // Set the stack pointer - asm(" mov r13,#0x200000"); - PRINT_STR("hello\n"); - TRACE_INIT_NAME(701, "proc_foo"); - TRACE_INIT_NAME(702, "proc_bar"); - TRACE_SWITCH(701); - if (global++ > 0) - global++; - foo1(); - TRACE_SWITCH(702); - if (global++ > 0) - global++; - bar(); - TRACE_SWITCH(701); - if (global++ > 0) - global++; - foo2(); - TRACE_SWITCH(703); - if (global++ > 0) - global++; - foo1(); - TRACE_SWITCH(701); - if (global++ > 0) - global++; - foo1(); - - TRACE_SWITCH(704); - if (global++ > 0) - global++; - foo1(); - - TRACE_SWITCH(701); - if (global++ > 0) - global++; - foo1(); - - TRACE_SWITCH(705); - if (global++ > 0) - global++; - foo1(); - - TRACE_SWITCH(701); - if (global++ > 0) - global++; - foo1(); - - TRACE_SWITCH(706); - if (global++ > 0) - global++; - foo1(); - - TRACE_SWITCH(701); - if (global++ > 0) - global++; - foo1(); - - TRACE_SWITCH(707); - if (global++ > 0) - global++; - foo1(); - - TRACE_SWITCH(701); - if (global++ > 0) - global++; - foo1(); - - TRACE_SWITCH(708); - if (global++ > 0) - global++; - foo1(); - - TRACE_SWITCH(701); - if (global++ > 0) - global++; - foo1(); - - TRACE_SWITCH(709); - if (global++ > 0) - global++; - foo1(); - - TRACE_SWITCH(701); - if (global++ > 0) - global++; - foo1(); - - TRACE_SWITCH(710); - if (global++ > 0) - global++; - foo1(); - - TRACE_STOP_EMU(); -} - -int foo1() -{ - int a = 0; - - int ii; - for (ii = 0; ii < 3; ++ii) { - a += child1(); - a += child2(); - a += child3(); - } - return a; -} - -int foo2() -{ - int a = 0; - - int ii; - for (ii = 0; ii < 2; ++ii) { - a += child3(); - a += child4(); - a += child5(); - } - return a; -} - -#define kStride 64 -void bar() -{ - int a = 0; - - static char mem[1000 * kStride]; - - int ii, jj; - - for (ii = 0; ii < 4; ++ii) { - for (jj = 0; jj < 10; ++jj) - a += mem[jj * kStride]; - foo1(); - foo2(); - } -} - -int child1() -{ - int a = 0; - - int ii; - for (ii = 0; ii < 2; ++ii) - a += ii; - return a; -} - -int child2() -{ - int a = 0; - - int ii; - for (ii = 0; ii < 4; ++ii) - a += ii; - return a; -} - -int child3() -{ - int a = 0; - - int ii; - for (ii = 0; ii < 6; ++ii) - a += ii; - return a; -} - -int child4() -{ - int a = 0; - - int ii; - for (ii = 0; ii < 8; ++ii) - a += ii; - return a; -} - -int child5() -{ - int a = 0; - - int ii; - for (ii = 0; ii < 10; ++ii) - a += ii; - return a; -} diff --git a/emulator/qtools/tests/macros.h b/emulator/qtools/tests/macros.h deleted file mode 100644 index 066374b..0000000 --- a/emulator/qtools/tests/macros.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef _TEST_TRACE_C_H_ -#define _TEST_TRACE_C_H_ - -/* the base address of trace device */ -#define TRACE_DEV_BASE_ADDR 0x21000000 - -/*the register addresses of the trace device */ -#define TRACE_DEV_REG_SWITCH 0 -#define TRACE_DEV_REG_FORK 1 -#define TRACE_DEV_REG_EXECVE_PID 2 -#define TRACE_DEV_REG_EXECVE_VMSTART 3 -#define TRACE_DEV_REG_EXECVE_VMEND 4 -#define TRACE_DEV_REG_EXECVE_OFFSET 5 -#define TRACE_DEV_REG_EXECVE_EXEPATH 6 -#define TRACE_DEV_REG_EXIT 7 -#define TRACE_DEV_REG_CMDLINE 8 -#define TRACE_DEV_REG_CMDLINE_LEN 9 -#define TRACE_DEV_REG_MMAP_EXEPATH 10 -#define TRACE_DEV_REG_INIT_PID 11 -#define TRACE_DEV_REG_INIT_NAME 12 -#define TRACE_DEV_REG_CLONE 13 -#define TRACE_DEV_REG_DYN_SYM 50 -#define TRACE_DEV_REG_DYN_SYM_ADDR 51 -#define TRACE_DEV_REG_PRINT_STR 60 -#define TRACE_DEV_REG_PRINT_NUM_DEC 61 -#define TRACE_DEV_REG_PRINT_NUM_HEX 62 -#define TRACE_DEV_REG_STOP_EMU 90 -#define TRACE_DEV_REG_ENABLE 100 -#define TRACE_DEV_REG_DISABLE 101 - -/* write a word to a trace device register */ -#define DEV_WRITE_WORD(addr,value)\ - (*(volatile unsigned long *)(TRACE_DEV_BASE_ADDR + ((addr) << 2)) = (value)) - -/*************************************************************/ -/* generates test events */ - -/* context switch */ -#define TRACE_SWITCH(pid) DEV_WRITE_WORD(TRACE_DEV_REG_SWITCH, (pid)) -/* fork */ -#define TRACE_FORK(pid) DEV_WRITE_WORD(TRACE_DEV_REG_FORK, (pid)) -/* clone */ -#define TRACE_CLONE(pid) DEV_WRITE_WORD(TRACE_DEV_REG_CLONE, (pid)) -/* dump name and path of threads executed before trace device created */ -#define TRACE_INIT_NAME(pid,path)\ -do {\ - DEV_WRITE_WORD(TRACE_DEV_REG_INIT_PID, (pid));\ - DEV_WRITE_WORD(TRACE_DEV_REG_INIT_NAME, (unsigned long)(path));\ -}while(0) -/* dump exec mapping of threads executed before trace device created */ -#define TRACE_INIT_EXEC(vstart,vend,eoff,path)\ -do {\ - DEV_WRITE_WORD(TRACE_DEV_REG_EXECVE_VMSTART, (vstart));\ - DEV_WRITE_WORD(TRACE_DEV_REG_EXECVE_VMEND, (vend));\ - DEV_WRITE_WORD(TRACE_DEV_REG_EXECVE_OFFSET, (eoff));\ - DEV_WRITE_WORD(TRACE_DEV_REG_EXECVE_EXEPATH, (unsigned long)(path));\ -}while(0) -/* mmap */ -#define TRACE_MMAP(vstart,vend,eoff,path)\ -do {\ - DEV_WRITE_WORD(TRACE_DEV_REG_EXECVE_VMSTART, (vstart));\ - DEV_WRITE_WORD(TRACE_DEV_REG_EXECVE_VMEND, (vend));\ - DEV_WRITE_WORD(TRACE_DEV_REG_EXECVE_OFFSET, (eoff));\ - DEV_WRITE_WORD(TRACE_DEV_REG_MMAP_EXEPATH, (unsigned long)(path));\ -}while(0) -/* execve */ -#define TRACE_EXECVE(cmdlen,cmd)\ -do {\ - DEV_WRITE_WORD(TRACE_DEV_REG_CMDLINE_LEN, (cmdlen));\ - DEV_WRITE_WORD(TRACE_DEV_REG_CMDLINE, (unsigned long)(cmd));\ -}while(0) -/* exit */ -#define TRACE_EXIT(retv) DEV_WRITE_WORD(TRACE_DEV_REG_EXIT, (retv)) - -/* other commands */ - -/* stop emulation */ -#define TRACE_STOP_EMU() DEV_WRITE_WORD(TRACE_DEV_REG_STOP_EMU, 1) -/* enable/disable tracing */ -#define TRACE_ENABLE_TRACING() DEV_WRITE_WORD(TRACE_DEV_REG_ENABLE, 1) -#define TRACE_DISABLE_TRACING() DEV_WRITE_WORD(TRACE_DEV_REG_DISABLE, 1) -/* dynamic symbols */ -#define TRACE_DYN_SYM(addr,sym)\ -do {\ - DEV_WRITE_WORD(TRACE_DEV_REG_DYN_SYM_ADDR, (addr));\ - DEV_WRITE_WORD(TRACE_DEV_REG_DYN_SYM, (unsigned long)(sym));\ -}while(0) -/* prints */ -#define PRINT_STR(str) DEV_WRITE_WORD(TRACE_DEV_REG_PRINT_STR, (unsigned long)(str)) -#define PRINT_NUM_DEC(num) DEV_WRITE_WORD(TRACE_DEV_REG_PRINT_NUM_DEC, (num)) -#define PRINT_NUM_HEX(num) DEV_WRITE_WORD(TRACE_DEV_REG_PRINT_NUM_HEX, (num)) - -#endif diff --git a/emulator/qtools/tests/tests.ld b/emulator/qtools/tests/tests.ld deleted file mode 100644 index 05fe41b..0000000 --- a/emulator/qtools/tests/tests.ld +++ /dev/null @@ -1,10 +0,0 @@ -SECTIONS { - TEXT_START = 0x00010000 ; - DATA_START = 0x00200000 ; - handlers 0x0 : { *(handlers) } - .text TEXT_START : { *(.text) } - .data DATA_START : { *(.data) } - .bss : { *(.bss) *(COMMON) } - p00300000 0x00300000 : { *(p00300000) } - p00400000 0x00400000 : { *(p00400000) } -} |