tests: use alloca when allocating scratch buffer for writesame

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>