diff --git a/README.md b/README.md index 07def0623..1869dbb0a 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,7 @@ hugetlbfs /mnt/huge hugetlbfs rw,mode=0777 0 0 # Compille Time Option -DTAP_IGNORE_ERROR: when packetgrapg can't burst or poll a tap, it return 0 instead of returning an error +-DPG_QEMU_MEM_SIZE=SIZE: allow to specify qemy ram size in test, parameter must be a string in qemu format, examples: -DPG_QEMU_MEM_SIZE="1G", -DPG_QEMU_MEM_SIZE="512M" # Licence diff --git a/src/utils/common.h b/src/utils/common.h index 9d022a724..9ed4e2ef1 100644 --- a/src/utils/common.h +++ b/src/utils/common.h @@ -48,7 +48,10 @@ static inline void pg_brick_ptrptr_destroy(struct pg_brick **brick) #define PG_STRCAT7(a, b, c, d, e, f, g) (a b c d e f g) #define PG_STRCAT8(a, b, c, d, e, f, g, h) (a b c d e f g h) #define PG_STRCAT9(a, b, c, d, e, f, g, h, i) (a b c d e f g h i) -#define PG_STRCAT10(a, b, c, d, e, f, g, h, i, j) (a b c d e f g h i j) +#define PG_STRCAT10(a, b, c, d, e, f, g, h, i, j) \ + (a b c d e f g h i j) +#define PG_STRCAT11(a, b, c, d, e, f, g, h, i, j, k) \ + (a b c d e f g h i j k) #define PG_CAT(a, b) a ## b diff --git a/src/utils/qemu.c b/src/utils/qemu.c index 10b451009..bb2033213 100644 --- a/src/utils/qemu.c +++ b/src/utils/qemu.c @@ -24,6 +24,10 @@ #include "utils/qemu.h" #include "utils/common.h" +#ifndef PG_QEMU_MEM_SIZE +#define PG_QEMU_MEM_SIZE "128G" +#endif + int pg_util_cmdloop(const char *cmd, int timeout_s) { struct timeval start, end; @@ -111,10 +115,13 @@ int pg_util_spawn_qemu(const char *socket_path_0, argv_qemu = g_strdup_printf( PG_STRCAT( - "qemu-system-x86_64 -m 1G -enable-kvm", + "qemu-system-x86_64 -m ", + PG_QEMU_MEM_SIZE, + " -enable-kvm", " -vnc :%u -display none -snapshot -object", - " memory-backend-file,id=mem,size=1G,", - "mem-path=%s,share=on -numa node,memdev=mem", + " memory-backend-file,id=mem,size=", + PG_QEMU_MEM_SIZE, + ",mem-path=%s,share=on -numa node,memdev=mem", " -mem-prealloc -drive file=%s", " -netdev user,id=net0,hostfwd=tcp::%u-:22", " -device e1000,netdev=net0%s%s",