rename memtests in memtest, remove it from testapps.

start it via mshell: memtest size mb/kb/b
This commit is contained in:
Marian Ohligs 2013-01-30 17:52:24 +01:00
parent a08d79fba5
commit 491bb39465
4 changed files with 34 additions and 9 deletions

2
.gitignore vendored
View File

@ -16,7 +16,7 @@ include/metalsvm/config.inc
tools/make_initrd
tools/scc_bootinfo.asm
newlib/examples/hello
newlib/examples/memtests
newlib/examples/memtest
newlib/examples/jacobi
newlib/examples/echo
newlib/examples/tests

View File

@ -549,7 +549,6 @@ struct testcase_t testcases[] = {
// USERSPACE_TC("/bin/jacobi", "Jacobi serial user space app"),
USERSPACE_TC("/bin/tests", "Tests user space app"),
//USERSPACE_TC("/bin/hello", "Hello userspace app"),
USERSPACE_TC("/bin/memtests", "malloc 8MB"),
KERNELSPACE_TC(producer_consumer, "Producer consumer kernel space test"),
KERNELSPACE_TC(join_test, "Join kernel space test"),
#ifdef CONFIG_ROCKCREEK

View File

@ -11,7 +11,7 @@ LDFLAGS =
default: all
all: memtests hello tests jacobi mshell server client rlogind
all: memtest hello tests jacobi mshell server client rlogind
jacobi: jacobi.o
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $< -lm
@ -19,8 +19,8 @@ jacobi: jacobi.o
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
chmod a-x $@.sym
memtests: memtests.o
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $< -lm
memtest: memtest.o
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $<
$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
chmod a-x $@.sym
@ -62,7 +62,7 @@ client: client.o
chmod a-x $@.sym
clean:
$(RM) hello tests server client rlogind memtests mshell jacobi hello *.sym *.o *~
$(RM) hello tests server client rlogind memtest mshell jacobi hello *.sym *.o *~
depend:
$(CC_FOR_TARGET) -MM $(CFLAGS) *.c > Makefile.dep

View File

@ -25,10 +25,36 @@
#include <errno.h>
#include <dirent.h>
/*file descriptor init*/
#define TEST_SIZE_MB 8
int print_usage() {
printf("usage: [size mb/kb/b]");
exit(0);
}
int main(int argc, char** argv)
{
uint8_t* test = malloc(sizeof(char)*TEST_SIZE_MB*1024*1024);
int m = 0;
uint32_t size = 0;
if(argc <= 2)
print_usage();
if(argc == 3) {
if(!strcmp(argv[2], "mb"))
m = 1024*1024;
else if(!strcmp(argv[2], "kb"))
m = 1024;
else if(!strcmp(argv[2], "b"))
m = 0;
else
print_usage();
}
if(argc > 3)
print_usage();
size = atoi(argv[1]);
if(size <= 0)
print_usage();
size *= m;
uint8_t* test = malloc(size);
printf("malloc(%d) - START: %p END: %p \n", size, test, test + size);
return 0;
}