rename memtests in memtest, remove it from testapps.
start it via mshell: memtest size mb/kb/b
This commit is contained in:
parent
a08d79fba5
commit
491bb39465
4 changed files with 34 additions and 9 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -16,7 +16,7 @@ include/metalsvm/config.inc
|
||||||
tools/make_initrd
|
tools/make_initrd
|
||||||
tools/scc_bootinfo.asm
|
tools/scc_bootinfo.asm
|
||||||
newlib/examples/hello
|
newlib/examples/hello
|
||||||
newlib/examples/memtests
|
newlib/examples/memtest
|
||||||
newlib/examples/jacobi
|
newlib/examples/jacobi
|
||||||
newlib/examples/echo
|
newlib/examples/echo
|
||||||
newlib/examples/tests
|
newlib/examples/tests
|
||||||
|
|
|
@ -549,7 +549,6 @@ struct testcase_t testcases[] = {
|
||||||
// USERSPACE_TC("/bin/jacobi", "Jacobi serial user space app"),
|
// USERSPACE_TC("/bin/jacobi", "Jacobi serial user space app"),
|
||||||
USERSPACE_TC("/bin/tests", "Tests user space app"),
|
USERSPACE_TC("/bin/tests", "Tests user space app"),
|
||||||
//USERSPACE_TC("/bin/hello", "Hello userspace 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(producer_consumer, "Producer consumer kernel space test"),
|
||||||
KERNELSPACE_TC(join_test, "Join kernel space test"),
|
KERNELSPACE_TC(join_test, "Join kernel space test"),
|
||||||
#ifdef CONFIG_ROCKCREEK
|
#ifdef CONFIG_ROCKCREEK
|
||||||
|
|
|
@ -11,7 +11,7 @@ LDFLAGS =
|
||||||
|
|
||||||
default: all
|
default: all
|
||||||
|
|
||||||
all: memtests hello tests jacobi mshell server client rlogind
|
all: memtest hello tests jacobi mshell server client rlogind
|
||||||
|
|
||||||
jacobi: jacobi.o
|
jacobi: jacobi.o
|
||||||
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $< -lm
|
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $< -lm
|
||||||
|
@ -19,8 +19,8 @@ jacobi: jacobi.o
|
||||||
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||||
chmod a-x $@.sym
|
chmod a-x $@.sym
|
||||||
|
|
||||||
memtests: memtests.o
|
memtest: memtest.o
|
||||||
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $< -lm
|
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $<
|
||||||
$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
|
$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
|
||||||
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||||
chmod a-x $@.sym
|
chmod a-x $@.sym
|
||||||
|
@ -62,7 +62,7 @@ client: client.o
|
||||||
chmod a-x $@.sym
|
chmod a-x $@.sym
|
||||||
|
|
||||||
clean:
|
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:
|
depend:
|
||||||
$(CC_FOR_TARGET) -MM $(CFLAGS) *.c > Makefile.dep
|
$(CC_FOR_TARGET) -MM $(CFLAGS) *.c > Makefile.dep
|
||||||
|
|
|
@ -25,10 +25,36 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
/*file descriptor init*/
|
int print_usage() {
|
||||||
#define TEST_SIZE_MB 8
|
printf("usage: [size mb/kb/b]");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
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;
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue