[spi][test] Add test for large (~1MB) data transfers
Also increase test app's heap size, since shared memory between
the test and SPI server is allocated from the heap.
Bug: 151102582
Test: com.android.trusty.swspi.test
Change-Id: I0447f74be56c259960392d2021cee567b34ffc40
diff --git a/spi/swspi-test/manifest.json b/spi/swspi-test/manifest.json
index b3abf64..b000474 100644
--- a/spi/swspi-test/manifest.json
+++ b/spi/swspi-test/manifest.json
@@ -1,5 +1,5 @@
{
"uuid": "73f889dd-306f-4253-b295-18ac53c17471",
- "min_heap": 40960,
+ "min_heap": 3145728,
"min_stack": 4096
}
diff --git a/spi/swspi-test/swspi-test.c b/spi/swspi-test/swspi-test.c
index 26a8266..f759d46 100644
--- a/spi/swspi-test/swspi-test.c
+++ b/spi/swspi-test/swspi-test.c
@@ -29,8 +29,8 @@
#include <trusty_unittest.h>
#define MAX_NUM_CMDS 32
-#define MAX_TOTAL_PAYLOAD 1024
-#define TXRX_SIZE 1024
+#define MAX_TOTAL_PAYLOAD 1024 * 1024 /* 1 MB */
+#define TXRX_SIZE MAX_TOTAL_PAYLOAD
#define CLK_SPEED 1000000 /* 1 MHz */
#define PAGE_SIZE getauxval(AT_PAGESZ)
@@ -361,6 +361,14 @@
EXPECT_EQ(rc, 0, "exec xfer 1024");
}
+TEST_P(swspi, very_large_data_xfer) {
+ int rc;
+ struct spi_test_dev* test_dev = _state->test_dev;
+
+ rc = exec_xfer(test_dev, MAX_TOTAL_PAYLOAD);
+ EXPECT_EQ(rc, 0);
+}
+
TEST_P(swspi, multi_segment_xfer) {
int rc;
void* tx0;
@@ -408,7 +416,7 @@
TEST_P(swspi, unidir_recv) {
int rc;
void* rx;
- uint8_t expected[TXRX_SIZE];
+ uint8_t expected[128];
size_t sz = sizeof(expected);
struct spi_dev* dev = &_state->test_dev->dev;
bool loopback = _state->test_dev->loopback;