Branch data Line data Source code
1 : : /* ccache.c --- Self test MIT ccache file readers.
2 : : * Copyright (C) 2002, 2003, 2006, 2007, 2008 Simon Josefsson
3 : : *
4 : : * This file is part of Shishi.
5 : : *
6 : : * Shishi is free software; you can redistribute it and/or modify
7 : : * it under the terms of the GNU General Public License as published by
8 : : * the Free Software Foundation; either version 3 of the License, or
9 : : * (at your option) any later version.
10 : : *
11 : : * Shishi is distributed in the hope that it will be useful,
12 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : : * GNU General Public License for more details.
15 : : *
16 : : * You should have received a copy of the GNU General Public License
17 : : * along with Shishi; if not, see http://www.gnu.org/licenses or write
18 : : * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
19 : : * Floor, Boston, MA 02110-1301, USA
20 : : *
21 : : */
22 : :
23 : : #include "utils.c"
24 : :
25 : : #define EXPECT 2
26 : :
27 : : void
28 : 1 : test (Shishi * handle)
29 : : {
30 : : Shishi_tkts *tkts;
31 : 1 : const char *ccache = getenv ("CCACHE1");
32 : : int rc;
33 : :
34 [ - + ]: 1 : if (!ccache)
35 : 0 : ccache = "ccache1.bin";
36 : :
37 : 1 : rc = shishi_tkts_from_ccache_file (handle, ccache, &tkts);
38 [ - + ]: 1 : if (rc != SHISHI_OK)
39 : 0 : fail ("shishi_tkts_from_ccache_file() failed (%d)\n", rc);
40 : :
41 [ - + ]: 1 : if (shishi_tkts_size (tkts) != EXPECT)
42 : 0 : fail ("shishi_tkts_size() failed (%d!=%d)\n",
43 : : shishi_tkts_size (tkts), EXPECT);
44 : :
45 : 1 : rc = shishi_tkts_write (tkts, stdout);
46 [ - + ]: 1 : if (rc != SHISHI_OK)
47 : 0 : fail ("shishi_tkts_write() failed (%d)\n", rc);
48 : :
49 : 1 : rc = shishi_tkts_print (tkts, stdout);
50 [ - + ]: 1 : if (rc != SHISHI_OK)
51 : 0 : fail ("shishi_tkts_print() failed (%d)\n", rc);
52 : :
53 : 1 : shishi_tkts_done (&tkts);
54 : 1 : }
|