Nux

Merge lp:~didrocks/nux/unity_support_test_caching into lp:nux

Proposed by Didier Roche-Tolomelli
Status: Merged
Merged at revision: 449
Proposed branch: lp:~didrocks/nux/unity_support_test_caching
Merge into: lp:nux
Diff against target: 65 lines (+24/-6)
1 file modified
tools/unity_support_test.c (+24/-6)
To merge this branch: bzr merge lp:~didrocks/nux/unity_support_test_caching
Reviewer Review Type Date Requested Status
Jay Taoko (community) Approve
Review via email: mp+74214@code.launchpad.net

Description of the change

add a new unity_support_test cache file to speed up consecutive run and an option to bypass it (LP: #842656)

To post a comment you must log in.
Revision history for this message
Jay Taoko (jaytaoko) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/unity_support_test.c'
2--- tools/unity_support_test.c 2011-06-13 08:17:36 +0000
3+++ tools/unity_support_test.c 2011-09-06 13:13:15 +0000
4@@ -484,17 +484,14 @@
5 Display *display = NULL;
6 GLXContext context = NULL;
7 TestResults results;
8+ char resultfilename[30];
9+ FILE *resultfile;
10+ int forcecheck = 0;
11
12 results.indirect = 0;
13 results.compiz = 0;
14 results.flags = 0;
15 results.error = NULL;
16- results.flags = 0;
17-
18- if (getenv ("UNITY_FORCE_START")) {
19- fprintf (stdout, "Warning: UNITY_FORCE_START enabled, no check for unity or compiz support.\n");
20- return 0;
21- }
22
23 // Basic command-line parsing.
24 for (int i = 1; i < argc; i++) {
25@@ -512,6 +509,9 @@
26 } else if ((strncmp (argv[i], "-c", 2) == 0) ||
27 (strncmp (argv[i], "--compiz", 8) == 0)) {
28 results.compiz = 1;
29+ } else if ((strncmp (argv[i], "-f", 2) == 0) ||
30+ (strncmp (argv[i], "--force-check", 13) == 0)) {
31+ forcecheck = 1;
32 } else if ((strncmp (argv[i], "-h", 2) == 0) ||
33 (strncmp (argv[i], "--help", 6) == 0)) {
34 print_help ();
35@@ -523,6 +523,19 @@
36 }
37 }
38
39+ // can skip some tests if not forced
40+ if (!forcecheck) {
41+ resultfile = fopen("/tmp/unity_support_test.0", "r");
42+ if (resultfile) {
43+ fclose(resultfile);
44+ return 0;
45+ }
46+ if (getenv ("UNITY_FORCE_START")) {
47+ fprintf (stdout, "Warning: UNITY_FORCE_START enabled, no check for unity or compiz support.\n");
48+ return 0;
49+ }
50+ }
51+
52 // Open a X11 connection and get the root window.
53 display = XOpenDisplay (display_name);
54 if (display == NULL) {
55@@ -587,5 +600,10 @@
56 if (results.error != NULL)
57 free (results.error);
58
59+ // drop result file
60+ sprintf(resultfilename, "/tmp/unity_support_test.%i", results.result);
61+ resultfile = fopen(resultfilename, "w");
62+ fclose(resultfile);
63+
64 return results.result;
65 }

Subscribers

People subscribed via source and target branches