kunit: added file and line number to expectations

- mock_validate_expectations's error message now includes this

- added spacing to make error messages more legible

Change-Id: I2fd975692f47a4bc25554b1c502d77792954bcc8
Signed-off-by: Felix Guo <felixguo@google.com>
diff --git a/include/test/mock.h b/include/test/mock.h
index b104fd6..a31e5d6 100644
--- a/include/test/mock.h
+++ b/include/test/mock.h
@@ -77,6 +77,8 @@
 	struct mock_matcher *matcher;
 	struct mock_method *method;
 	int times_called;
+	const char *file_name;
+	int line_no;
 	/* internal list of prerequisites */
 	struct list_head prerequisites;
 };
@@ -250,7 +252,18 @@
  * A &struct mock_expectation representing the call expectation.
  * allowing additional conditions and actions to be specified.
  */
-#define EXPECT_CALL(expectation_call) mock_master_##expectation_call
+#define EXPECT_CALL(expectation_call) \
+	expect_call_wrapper(__FILE__, __LINE__, mock_master_##expectation_call)
+
+static inline struct mock_expectation *expect_call_wrapper(
+	const char *file_name,
+	int line_no,
+	struct mock_expectation *expectation)
+{
+	expectation->file_name = file_name;
+	expectation->line_no = line_no;
+	return expectation;
+}
 
 /**
  * Times() - sets the number of times a method is expected be called with the
diff --git a/test/mock.c b/test/mock.c
index 5d44f71..13fc1ef 100644
--- a/test/mock.c
+++ b/test/mock.c
@@ -49,7 +49,8 @@
 	struct test_stream *stream)
 {
 	stream->add(stream,
-		    "Expectation was not called the specified number of times:\n\t");
+		    "%s:%d - Expectation was not called the specified number of times:\n\t",
+		    expectation->file_name, expectation->line_no);
 	stream->add(stream,
 		    "Function: %s, min calls: %d, max calls: %d, actual calls: %d",
 		    expectation->method->method_name,