File: md5.test

package info (click to toggle)
makepp 2.0.98.5-2.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 2,744 kB
  • sloc: perl: 15,893; makefile: 38; javascript: 25; sh: 1
file content (130 lines) | stat: -rw-r--r-- 4,129 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
###	SPAR <http://www.cpan.org/scripts/>
###	1	644	1329052295	1329052295	is_relevant.pl
have_cc
###	34	644	1356724506	1366573638	makepp_test_script.pl
# Tests several things about C compilation:
# 1) Correctly parsing command lines to scan for include files.
# 2) Correctly calculating checksums so if files change we do not
#    rebuild, but we always rebuild when necessary.
# 3) Iteration 13 does not recompile even though signature would be
#    different, because file did not change, so it was not recalculated.
# 4) The builtin rules work.
#
# Replace the .c file multiple times and see which replacements trigger a rebuild.

my $obj;
my @args = ('makepp_signature_C_flat=0', is_windows ? '--no-path-exe-dep' : ());
my $compiled;
$Mpp::mod_answer = sub { $_[2] =~ s/ 0 / 1 / } if is_windows;
for $iter ( 0..3, 13, 10 ) {	# 13 & 10 repeat 3 & 0, but with flat option
  if( $iter == 13 ) { $args[0] =~ tr/0/1/ }
  else { c_cp 'compilation_test_'.($iter%10).'.c', 'compilation_test.c' }
  # This is slow and low-tech, but we need to guarantee that the .o timestamp changes
  # between runs, even if the files are on NFS (so that we cannot rely on calls to time).
  wait_timestamp "compilation_test.$obj" if $compiled;
  print "**** Iteration $iter\n";
  makepp @args, 'CPPFLAGS=-I subdir1 -Isubdir2', 'compilation_test';
				# We test both the "-I subdir" and "-Isubdir"
				# syntax.
  system '.' . (0 < is_windows ? '\\' : '/') . "compilation_test > iteration_$iter";
  $obj ||= is_windows && -f 'compilation_test.obj' ? 'obj' : 'o';
  c_grep 'm@subdir1/x2\.h@', ".makepp/compilation_test.$obj.mk" unless $iter;
				# Make sure makepp found x2 in subdir1, not in the
				# main directory.  Always same, so just on 1st round.

  $compiled = "0 0 0\n" ne n_files "n_files_$iter",
    !$iter && sub { die if /warning: can't locate file/ }; # Make sure makepp found all include files.
}
1;
###	10	644	1067451873	1055627995	compilation_test_0.c
#include <stdio.h>
#include "x.h"
#include "y.h"


int main()
{
  printf("%d %d %d %d\n", __LINE__, X, X2, Y);
  return 0;
}
###	10	644	1067451873	1055628000	compilation_test_1.c
#include <stdio.h>
#include "x.h"
#include "y.h"

/* Same except that a comment was added. */
int main()
{
  printf("%d %d %d %d\n", __LINE__, X, X2, Y);
  return 0;
}
###	11	644	1067451873	1055628006	compilation_test_2.c
#include <stdio.h>
#include "x.h"
#include "y.h"

/* Line count has changed!  Should recompile if not flat option. */

int main()
{
  printf("%d %d %d %d\n", __LINE__, X, X2, Y);
  return 0;
}
###	11	644	1067451873	1055628020	compilation_test_3.c
#include <stdio.h>
#include "x.h"
#include "y.h"

   /* Only whitespace has changed.  No recompilation. */
 // This is a C++ comment
int main()
{
                  printf("%d %d %d %d\n",       __LINE__, X, X2, Y);
                  /* another comment that is ignored */  return 0;
}
###	D	755	1067451873	1056139580	subdir1
###	6	644	1067451873	1055626466	subdir1/Makeppfile
x.h:
	&echo '#define X 1' -o $(output)
	&echo '#include "x2.h"' -o >>$(output)

x2.h:
	&echo '#define X2 2' -o $(output)
###	D	755	1067451873	1056139580	subdir2
###	8	644	1067451873	1055626463	subdir2/Makeppfile
x.h:
	&echo '#define X 99' -o $(output)

x2.h:
	&echo '#define X2 100' -o $(output)

y.h:
	&echo '#define Y 4' -o $(output)
###	2	644	1067451873	1055551960	x2.h
/* This file should be ignored. */
#define X2 3
###	D	755	1067451873	1055628127	answers
###	1	644	1067451873	1055628033	answers/iteration_0
8 1 2 4
###	1	644	1067451873	1055628036	answers/iteration_1
8 1 2 4
###	1	644	1067451873	1055628038	answers/iteration_2
9 1 2 4
###	1	644	1067451873	1055628041	answers/iteration_3
9 1 2 4
###	1	644	1356724506	1356724506	answers/iteration_13
9 1 2 4
###	1	644	1356724506	1356724506	answers/iteration_10
8 1 2 4
###	1	644	1067451873	1190053877	answers/n_files_0
5 0 0
###	1	644	1067451873	1190053880	answers/n_files_1
0 0 0
###	1	644	1067451873	1190053884	answers/n_files_2
2 0 0
###	1	644	1067451873	1190053887	answers/n_files_3
0 0 0
###	1	644	1356724506	1356724506	answers/n_files_13
0 0 0
###	1	644	1356724506	1356724506	answers/n_files_10
2 0 0