Debian Codegraph @

unittest/test_profile.c

raw symbols SCIP
1 /*
2 Copyright (C) 2015, 2017, 2020 R. Bernstein <[email protected]>
3 This file is part of GNU Make (remake variant).
4
5 GNU Make is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 GNU Make is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNU Make; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
19
20 #include "../src/config.h"
21 #include "../src/types.h"
22 #include "../src/file_basic.h"
23 #include "../src/profile.h"
24 #include "../src/dep.h"
25
26 #define TS_RES (1000)
27 #define TS_INC (5 * TS_RES)
28 static FILE_TIMESTAMP fake_clock = 0;
29
30 void
31 die (int status)
32 {
33 exit (status);
34 }
35
36 FILE_TIMESTAMP
37 file_timestamp_now (int *resolution) {
38 *resolution = TS_RES;
39
40 fake_clock += TS_INC;
41 return fake_clock;
42 }
43
44 int main(int argc, const char * const* argv) {
45 bool rc = profile_init(PACKAGE_TARNAME " " PACKAGE_VERSION, argv, 0);
46 (void)argc;
47 init_hash_files();
48
49 if (rc) {
50 file_t *target = enter_file("Makefile");
51 file_t *target2, *target3;
52 goaldep_t *goals = alloc_goaldep();
53
54 target->floc.filenm = "Makefile";
55 goals->file = target;
56
57 target2 = enter_file("all");
58 target2->floc.filenm = "Makefile";
59 target2->floc.lineno = 5;
60 target2->elapsed_time = 500;
61 profile_add_dependency(target2, NULL);
62
63 target3 = enter_file("all-recursive");
64 target3->floc.filenm = "Makefile";
65 target3->floc.lineno = 5;
66 target3->elapsed_time = 1000;
67 profile_add_dependency(target3, target2);
68
69 profile_close("Program termination", goals, 0);
70 }
71
72 if (rc == true) {
73 return 0;
74 } else {
75 return 1;
76 }
77 }