summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2017-09-19 17:31:58 +0100
committerP. F. Chimento <philip.chimento@gmail.com>2018-01-10 10:28:35 -0800
commitd409acb19785a3d42ccea934f584ab67a052eea2 (patch)
tree372a936b54ec4674b46faf4f75160cabca2a9e0c
parent9febff20c71f7112a3652cba81d41b260c178716 (diff)
Add test for profiling API
-rw-r--r--test/Makefile.am.inc1
-rw-r--r--test/endless/run-tests.c1
-rw-r--r--test/endless/run-tests.h1
-rw-r--r--test/endless/test-profile.c30
4 files changed, 33 insertions, 0 deletions
diff --git a/test/Makefile.am.inc b/test/Makefile.am.inc
index d2132ff..08a925a 100644
--- a/test/Makefile.am.inc
+++ b/test/Makefile.am.inc
@@ -18,6 +18,7 @@ test_endless_run_tests_SOURCES = \
test/endless/test-window.c \
test/endless/test-flexy-grid.c \
test/endless/test-custom-container.c \
+ test/endless/test-profile.c \
$(NULL)
test_endless_run_tests_CPPFLAGS = $(TEST_FLAGS)
test_endless_run_tests_LDADD = $(TEST_LIBS)
diff --git a/test/endless/run-tests.c b/test/endless/run-tests.c
index 232f51e..2629932 100644
--- a/test/endless/run-tests.c
+++ b/test/endless/run-tests.c
@@ -108,6 +108,7 @@ main (int argc,
add_page_manager_tests ();
add_flexy_grid_test ();
add_custom_container_tests ();
+ add_profile_tests ();
return g_test_run ();
}
diff --git a/test/endless/run-tests.h b/test/endless/run-tests.h
index b43ef53..a64046b 100644
--- a/test/endless/run-tests.h
+++ b/test/endless/run-tests.h
@@ -41,5 +41,6 @@ void add_action_menu_tests (void);
void add_action_button_tests (void);
void add_flexy_grid_test (void);
void add_custom_container_tests (void);
+void add_profile_tests (void);
#endif /* RUN_TESTS_H */
diff --git a/test/endless/test-profile.c b/test/endless/test-profile.c
new file mode 100644
index 0000000..398858e
--- /dev/null
+++ b/test/endless/test-profile.c
@@ -0,0 +1,30 @@
+/* Copyright 2017 Endless Mobile, Inc. */
+
+#include <stdlib.h>
+#include <endless/endless.h>
+
+#include "run-tests.h"
+
+static void
+test_profile_stdout (void)
+{
+ g_autoptr(EosProfileProbe) probe = EOS_PROFILE_PROBE ("/sdk/profile/main");
+
+ for (int i = 0; i < 256000; i++)
+ {
+ g_autoptr(EosProfileProbe) inner = EOS_PROFILE_PROBE ("/sdk/profile/inner-loop");
+
+ GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
+
+ for (int j = 0; j < 1000; j++)
+ g_array_append_val (array, j);
+
+ g_array_unref (array);
+ }
+}
+
+void
+add_profile_tests (void)
+{
+ g_test_add_func ("/profile/stdout", test_profile_stdout);
+}