diff --git a/tests/config-parser-test.c b/tests/config-parser-test.c
index 12a8fbd890e141acc6b69233e3ad1cab33776eed..83e89ba4267802df85eea0da2c51f25a955b3426 100644
--- a/tests/config-parser-test.c
+++ b/tests/config-parser-test.c
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include "config-parser.h"
 
@@ -37,7 +38,7 @@ run_test(const char *text)
 
 	fd = mkstemp(file);
 	len = write(fd, text, strlen(text));
-	assert(len == strlen(text));
+	assert(len == (int) strlen(text));
 
 	config = weston_config_parse(fd);
 	close(fd);