~ubuntu-branches/ubuntu/trusty/dds/trusty

« back to all changes in this revision

Viewing changes to debian/patches/ddd-exitcode

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2008-10-30 23:19:27 UTC
  • mfrom: (1.1.3 upstream) (7.2.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20081030231927-yvf4f2tmezkl45av
Tags: 1.1.9+ddd105-2
Update watch file with correct dversionmangling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# make ddd exit with code 1 if something goes wrong, especially the test suite
 
2
 
 
3
--- a/ddd/ddd.cpp
 
4
+++ b/ddd/ddd.cpp
 
5
@@ -151,6 +151,7 @@ int main(int argc, char *argv[])
 
6
   unsigned int genseed=0;
 
7
   FILE *fp;
 
8
   cTimer timer;
 
9
+  int success = true;
 
10
 
 
11
   struct deal dl;
 
12
   struct futureTricks fut;
 
13
@@ -282,19 +283,19 @@ int main(int argc, char *argv[])
 
14
   }
 
15
 
 
16
   if(gen > 0)
 
17
-  { generate(gen,genseed,gencards,gentricks);
 
18
+  { success = generate(gen,genseed,gencards,gentricks);
 
19
     goto cleanup;
 
20
   }
 
21
   if(btimeall)
 
22
-  { timeAll(pszfile,trumps,leader);
 
23
+  { success = timeAll(pszfile,trumps,leader);
 
24
     goto cleanup;
 
25
   }
 
26
   else if(pszxcn)
 
27
-  { timeg(pszfile,-1,1,1,pszxcn,(leader==-1?0:leader),bverbose);
 
28
+  { success = timeg(pszfile,-1,1,1,pszxcn,(leader==-1?0:leader),bverbose);
 
29
     goto cleanup;
 
30
   }
 
31
   else if(pszgiblib)
 
32
-  { giblib(pszfile,-1,1,1,pszgiblib);
 
33
+  { success = giblib(pszfile,-1,1,1,pszgiblib);
 
34
     goto cleanup;
 
35
   }
 
36
 
 
37
@@ -312,7 +313,7 @@ int main(int argc, char *argv[])
 
38
   }
 
39
 
 
40
   if(btricks)
 
41
-  { tricks(&gib,deal,-1,1,1);
 
42
+  { success = tricks(&gib,deal,-1,1,1);
 
43
     goto cleanup;
 
44
   }
 
45
 
 
46
@@ -330,7 +331,7 @@ int main(int argc, char *argv[])
 
47
   }
 
48
 
 
49
   // set up dds10
 
50
-  if(setDDS(&gib,&dl) == false)
 
51
+  if(success = setDDS(&gib,&dl) == false)
 
52
     return -1;
 
53
 
 
54
   printf("\n");
 
55
@@ -352,7 +353,7 @@ int main(int argc, char *argv[])
 
56
   cleanup:
 
57
   cleanSB();
 
58
 
 
59
-  return 0;
 
60
+  return !success;
 
61
 
 
62
 } // main
 
63
 // *****************************************************************************
 
64
@@ -757,8 +758,11 @@ bool giblib(char *pszfile, int target, i
 
65
          pszgiblib,format64(totalnodes,sz1),
 
66
          ntotal?format64(totalnodes/ntotal,sz2):format64(totalnodes,sz2),
 
67
          totalelapsed,ntotal?totalelapsed/(double)ntotal:totalelapsed);
 
68
-  if(nerror)
 
69
+  if(nerror) 
 
70
+  {
 
71
     printf("*** ERROR: nerror=%d, tricks and score different\n",nerror);
 
72
+    return false;
 
73
+  }
 
74
   printf("\n");
 
75
 
 
76
   fclose(fp);