From 404dd2bddd3962f6eee3aed98a5cc66033e511f0 Mon Sep 17 00:00:00 2001 From: Brendan Bartels <bbartels@iastate.edu> Date: Sun, 2 Apr 2017 11:02:29 -0500 Subject: [PATCH] quad: add 512 MB RAM limit to test scripts using virtual quad --- quad/scripts/tests/test_safety_checks.rb | 2 +- quad/scripts/tests/test_unix_uart.rb | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/quad/scripts/tests/test_safety_checks.rb b/quad/scripts/tests/test_safety_checks.rb index f2f35d30d..f13efe4a0 100644 --- a/quad/scripts/tests/test_safety_checks.rb +++ b/quad/scripts/tests/test_safety_checks.rb @@ -90,7 +90,7 @@ Timeout::timeout(30) { sleep 1 # Start virtual quad - quad_pid = Process.spawn("./virt-quad") + quad_pid = Process.spawn("./virt-quad", :rlimit_as => 536870912) # 512 MiB RAM sleep 5 diff --git a/quad/scripts/tests/test_unix_uart.rb b/quad/scripts/tests/test_unix_uart.rb index 6b5d14693..f8f4054e8 100644 --- a/quad/scripts/tests/test_unix_uart.rb +++ b/quad/scripts/tests/test_unix_uart.rb @@ -29,7 +29,7 @@ Timeout::timeout(30) { sleep 1 # Start virtual quad - quad_pid = Process.spawn("./virt-quad") + quad_pid = Process.spawn("./virt-quad", :rlimit_as => 536870912) # 512 MiB RAM sleep 5 @@ -50,11 +50,15 @@ Timeout::timeout(30) { File.write(UART_RX, [0xBE, 1, 0, 0, 0, 0, 0, 0xBF].pack("CCCCCCCC")) fifo = File.open(UART_TX) + + # Receive the header msg = [] for i in 1..7 sleep 0.010 msg.push(fifo.read(1)) end + + # Receive the remaining data, according to the header specified length length = msg[5..7].join().unpack("S")[0] msg = [] for i in 1..length -- GitLab