tests: add #96 #558 and #1330

These verfy that the 'memory tracking' subsystem is actually doing its
job when using curl tool (#96), a test in libtest (#558) and also a unit
test (#1330), in order to prevent regressions in this functionallity.
This commit is contained in:
Yang Tse 2013-03-15 19:58:00 +01:00
parent a8f93d4efc
commit 1700668d78
10 changed files with 387 additions and 123 deletions

View File

@ -191,6 +191,7 @@ unittest
debug
TLS-SRP
Metalink
TrackMemory
as well as each protocol that curl supports. A protocol only needs to be
specified if it is different from the server (useful when the server
@ -250,7 +251,7 @@ If a CONNECT is used to the server (to emulate HTTPS etc over proxy), the port
number given in the CONNECT request will be used to identify which test that
is being run, if the proxy host name is said to start with 'test'.
If there's no non-zero test number found in the above to places, the HTTP test
If there's no non-zero test number found in the above two places, the HTTP test
server will use the number following the last dot in the given url so that
"foo.bar.123" gets treated as test case 123.

View File

@ -3,105 +3,120 @@ install:
test:
# this list is in numerical order
TESTCASES = test1 test2 test3 test4 test5 test6 test7 test8 test9 \
test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \
test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \
test30 test31 test32 test33 test34 test35 test36 test37 test38 test39 \
test40 test41 test42 test43 test44 test45 test46 test47 test48 test49 \
test50 test51 test52 test53 test54 test55 test56 test57 test58 test59 \
test60 test61 test62 test63 test64 test65 test66 test67 test68 test69 \
test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \
test80 test81 test82 test83 test84 test85 test86 test87 test88 test89 \
test90 test91 test92 test93 test94 test95 test97 test98 test99 test100 \
test101 test102 test103 test104 test105 test106 test107 test108 test109 \
test110 test111 test112 test113 test114 test115 test116 test117 test118 \
test119 test120 test121 test122 test123 test124 test125 test126 test127 \
test128 test129 test130 test131 test132 test133 test134 test135 test136 \
test137 test138 test139 test140 test141 test142 test143 test144 test145 \
test146 test147 test148 test149 test150 test151 test152 test153 test154 \
test155 test156 test157 test158 test159 test160 test161 test162 test163 \
test164 test165 test166 test167 test168 test169 test170 test171 test172 \
test173 test174 test175 test176 test177 test178 test179 test180 test181 \
test182 test183 test184 test185 test186 test187 test188 test189 test190 \
test191 test192 test193 test194 test195 test196 test197 test198 test199 \
test200 test201 test202 test203 test204 test205 test206 test207 test208 \
test209 test210 test211 test212 test213 test214 test215 test216 test217 \
test218 test220 test221 test222 test223 test224 test225 test226 test227 \
test228 test229 test231 test233 test234 test235 test236 test237 test238 \
test239 test240 test241 test242 test243 test245 test246 test247 test248 \
test249 test250 test251 test252 test253 test254 test255 test256 test257 \
test258 test259 test260 test261 test262 test263 test264 test265 test266 \
test267 test268 test269 test270 test271 test272 test273 test274 test275 \
test276 test277 test278 test279 test280 test281 test282 test283 test284 \
test285 test286 test287 test288 test289 test290 test291 test292 test293 \
test294 test295 test296 test297 test298 test299 test300 test301 test302 \
test303 test304 test305 test306 test307 test308 test309 test310 test311 \
test312 test313 test320 test321 test322 test323 test324 test350 test351 \
test352 test353 test354 test400 test401 test402 test403 test404 test405 \
test406 test407 test408 test409 test500 test501 test502 test503 test504 \
test505 test506 test507 test508 test509 test510 test511 test512 test513 \
test514 test515 test516 test517 test518 test519 test520 test521 test522 \
test523 test524 test525 test526 test527 test528 test529 test530 test531 \
test532 test533 test534 test535 test536 test537 test538 test539 test540 \
test541 test542 test543 test544 test545 test546 test547 test548 test549 \
test550 test551 test552 test553 test554 test555 test556 test557 test560 \
test561 test562 test563 test564 test565 test566 test567 test568 test569 \
test570 test571 test572 test573 test574 test575 test576 test578 test579 \
test580 test581 test582 test583 test584 test585 test586 test587 test588 \
TESTCASES = test1 test2 test3 test4 test5 test6 test7 test8 test9 \
test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \
test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \
test30 test31 test32 test33 test34 test35 test36 test37 test38 test39 \
test40 test41 test42 test43 test44 test45 test46 test47 test48 test49 \
test50 test51 test52 test53 test54 test55 test56 test57 test58 test59 \
test60 test61 test62 test63 test64 test65 test66 test67 test68 test69 \
test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \
test80 test81 test82 test83 test84 test85 test86 test87 test88 test89 \
test90 test91 test92 test93 test94 test95 test96 test97 test98 test99 \
test100 test101 test102 test103 test104 test105 test106 test107 test108 \
test109 test110 test111 test112 test113 test114 test115 test116 test117 \
test118 test119 test120 test121 test122 test123 test124 test125 test126 \
test127 test128 test129 test130 test131 test132 test133 test134 test135 \
test136 test137 test138 test139 test140 test141 test142 test143 test144 \
test145 test146 test147 test148 test149 test150 test151 test152 test153 \
test154 test155 test156 test157 test158 test159 test160 test161 test162 \
test163 test164 test165 test166 test167 test168 test169 test170 test171 \
test172 test173 test174 test175 test176 test177 test178 test179 test180 \
test181 test182 test183 test184 test185 test186 test187 test188 test189 \
test190 test191 test192 test193 test194 test195 test196 test197 test198 \
test199 test200 test201 test202 test203 test204 test205 test206 test207 \
test208 test209 test210 test211 test212 test213 test214 test215 test216 \
test217 test218 test220 test221 test222 test223 test224 test225 \
test226 test227 test228 test229 test231 test233 test234 \
test235 test236 test237 test238 test239 test240 test241 test242 test243 \
test245 test246 test247 test248 test249 test250 test251 test252 \
test253 test254 test255 test256 test257 test258 test259 test260 test261 \
test262 test263 test264 test265 test266 test267 test268 test269 test270 \
test271 test272 test273 test274 test275 test276 test277 test278 test279 \
test280 test281 test282 test283 test284 test285 test286 test287 test288 \
test289 test290 test291 test292 test293 test294 test295 test296 test297 \
test298 test299 test300 test301 test302 test303 test304 test305 test306 \
test307 test308 test309 test310 test311 test312 test313 \
test320 test321 test322 test323 test324 \
test350 test351 test352 test353 test354 \
\
test400 test401 test402 test403 test404 test405 test406 test407 test408 \
test409 \
\
test500 test501 test502 test503 test504 test505 test506 test507 test508 \
test509 test510 test511 test512 test513 test514 test515 test516 test517 \
test518 test519 test520 test521 test522 test523 test524 test525 test526 \
test527 test528 test529 test530 test531 test532 test533 test534 test535 \
test536 test537 test538 test539 test540 test541 test542 test543 test544 \
test545 test546 test547 test548 test549 test550 test551 test552 test553 \
test554 test555 test556 test557 test558 test560 test561 test562 \
test563 test564 test565 test566 test567 test568 test569 test570 test571 \
test572 test573 test574 test575 test576 test578 test579 test580 \
test581 test582 test583 test584 test585 test586 test587 test588 \
test590 test591 test592 test593 test594 test595 test596 test597 test598 \
test599 test600 test601 test602 test603 test604 \
test605 test606 test607 test608 test609 test610 test611 test612 test613 \
test614 test615 test616 test617 test618 test619 test620 test621 test622 \
test623 test624 test625 test626 test627 test628 test629 test630 test631 \
test632 test633 test634 test635 test636 test637 test638 test639 \
test700 test701 test702 test703 test704 test705 test706 test707 test708 \
test709 test710 \
test800 test801 test802 test803 test804 test805 test806 test807 test808 \
test850 test851 test852 test853 test854 test855 test856 test857 \
test900 test901 test902 test903 test904 test905 test906 \
test1000 test1001 test1002 test1003 test1004 test1005 \
test1006 test1007 test1008 test1009 test1010 test1011 test1012 test1013 \
test1014 test1015 test1016 test1017 test1018 test1019 test1020 test1021 \
test1022 test1023 test1024 test1025 test1026 test1027 test1028 test1029 \
test1030 test1031 test1032 test1033 test1034 test1035 test1036 test1037 \
test1038 test1039 test1040 test1041 test1042 test1043 test1044 test1045 \
test1046 test1047 test1048 test1049 test1050 test1051 test1052 test1053 \
test1054 test1055 test1056 test1057 test1058 test1059 test1060 test1061 \
test1062 test1063 test1064 test1065 test1066 test1067 test1068 test1069 \
test1070 test1071 test1072 test1073 test1074 test1075 test1076 test1077 \
test1078 test1079 test1080 test1081 test1082 test1083 test1084 test1085 \
test1086 test1087 test1088 test1089 test1090 test1091 test1092 test1093 \
test1094 test1095 test1096 test1097 test1098 test1099 test1100 test1101 \
test1102 test1103 test1104 test1105 test1106 test1107 test1108 test1109 \
test1110 test1111 test1112 test1113 test1114 test1115 test1116 test1117 \
test1118 test1119 test1120 test1121 test1122 test1123 test1124 test1125 \
test1126 test1127 test1128 test1129 test1130 test1131 test1132 test1133 \
test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 \
test599 test600 test601 test602 test603 test604 test605 test606 test607 \
test608 test609 test610 test611 test612 test613 test614 test615 test616 \
test617 test618 test619 test620 test621 test622 test623 test624 test625 \
test626 test627 test628 test629 test630 test631 test632 test633 test634 \
test635 test636 test637 test638 test639 \
\
test700 test701 test702 test703 test704 test705 test706 test707 test708 \
test709 test710 \
\
test800 test801 test802 test803 test804 test805 test806 test807 test808 \
\
test850 test851 test852 test853 test854 test855 test856 test857 \
\
test900 test901 test902 test903 test904 test905 test906 \
\
test1000 test1001 test1002 test1003 test1004 test1005 test1006 test1007 \
test1008 test1009 test1010 test1011 test1012 test1013 test1014 test1015 \
test1016 test1017 test1018 test1019 test1020 test1021 test1022 test1023 \
test1024 test1025 test1026 test1027 test1028 test1029 test1030 test1031 \
test1032 test1033 test1034 test1035 test1036 test1037 test1038 test1039 \
test1040 test1041 test1042 test1043 test1044 test1045 test1046 test1047 \
test1048 test1049 test1050 test1051 test1052 test1053 test1054 test1055 \
test1056 test1057 test1058 test1059 test1060 test1061 test1062 test1063 \
test1064 test1065 test1066 test1067 test1068 test1069 test1070 test1071 \
test1072 test1073 test1074 test1075 test1076 test1077 test1078 test1079 \
test1080 test1081 test1082 test1083 test1084 test1085 test1086 test1087 \
test1088 test1089 test1090 test1091 test1092 test1093 test1094 test1095 \
test1096 test1097 test1098 test1099 test1100 test1101 test1102 test1103 \
test1104 test1105 test1106 test1107 test1108 test1109 test1110 test1111 \
test1112 test1113 test1114 test1115 test1116 test1117 test1118 test1119 \
test1120 test1121 test1122 test1123 test1124 test1125 test1126 test1127 \
test1128 test1129 test1130 test1131 test1132 test1133 \
\
test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 \
test1208 test1209 test1210 test1211 test1212 test1213 test1214 \
test1220 test1221 test1222 test1223 \
test1300 test1301 test1302 test1303 test1304 test1305 \
test1306 test1307 test1308 test1309 test1310 test1311 test1312 test1313 \
test1314 test1315 test1316 test1317 test1318 test1319 test1320 test1321 \
test1322 test1323 test1324 test1325 test1326 test1327 test1328 test1329 \
test1331 test1332 test1333 test1334 test1335 test1336 test1337 test1338 \
test1339 test1340 test1341 test1342 test1343 test1344 test1345 test1346 \
test1347 test1348 test1349 test1350 test1351 test1352 test1353 test1354 \
test1355 test1356 test1357 test1358 test1359 test1360 test1361 test1362 \
test1363 test1364 test1365 test1366 test1367 test1368 test1369 test1370 \
test1371 test1372 test1373 test1374 test1375 test1376 test1377 test1378 \
test1379 test1380 test1381 test1382 test1383 test1384 test1385 test1386 \
test1387 test1388 test1389 test1390 test1391 test1392 test1393 \
test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 \
test1408 test1409 test1410 test1411 test1412 test1413 \
test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \
test1508 \
\
test1220 test1221 test1222 test1223 \
\
test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \
test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \
test1316 test1317 test1318 test1319 test1320 test1321 test1322 test1323 \
test1324 test1325 test1326 test1327 test1328 test1329 test1330 test1331 \
test1332 test1333 test1334 test1335 test1336 test1337 test1338 test1339 \
test1340 test1341 test1342 test1343 test1344 test1345 test1346 test1347 \
test1348 test1349 test1350 test1351 test1352 test1353 test1354 test1355 \
test1356 test1357 test1358 test1359 test1360 test1361 test1362 test1363 \
test1364 test1365 test1366 test1367 test1368 test1369 test1370 test1371 \
test1372 test1373 test1374 test1375 test1376 test1377 test1378 test1379 \
test1380 test1381 test1382 test1383 test1384 test1385 test1386 test1387 \
test1388 test1389 test1390 test1391 test1392 test1393 \
\
test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 \
test1408 test1409 test1410 test1411 test1412 test1413 \
\
test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \
test1508 \
\
test1900 test1901 test1902 test1903 \
test2000 test2001 test2002 test2003 test2004 test2005 test2006 test2007 \
test2008 test2009 test2010 test2011 test2012 test2013 test2014 test2015 \
test2016 test2017 test2018 test2019 test2020 test2021 test2022 \
test2023 test2024 test2025 \
test2026 test2027 test2028 \
test2029 test2030 test2031 \
\
test2000 test2001 test2002 test2003 test2004 test2005 test2006 test2007 \
test2008 test2009 test2010 test2011 test2012 test2013 test2014 test2015 \
test2016 test2017 test2018 test2019 test2020 test2021 test2022 test2023 \
test2024 test2025 test2026 test2027 test2028 test2029 test2030 test2031 \
test2032 test2033
EXTRA_DIST = $(TESTCASES) DISABLED

50
tests/data/test1330 Normal file
View File

@ -0,0 +1,50 @@
<testcase>
<info>
<keywords>
unittest
TrackMemory
</keywords>
</info>
#
# Server-side
<reply>
</reply>
# Client-side
<client>
<server>
none
</server>
<features>
unittest
TrackMemory
</features>
# tool is what to use instead of 'curl'
<tool>
unit1330
</tool>
<name>
unit tests memory tracking operational
</name>
<command>
nothing
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<file name="log/memdump" mode="text">
MEM ../../../tests/unit/unit1330.c: malloc()
MEM ../../../tests/unit/unit1330.c: free()
</file>
<stripfile>
s/ =.*//
s/\(.*\)/()/
s/:\d+/:/
</stripfile>
</verify>
</testcase>

52
tests/data/test558 Normal file
View File

@ -0,0 +1,52 @@
<testcase>
<info>
<keywords>
TrackMemory
</keywords>
</info>
#
# Server-side
<reply>
</reply>
# Client-side
<client>
<server>
none
</server>
<features>
TrackMemory
</features>
# tool is what to use instead of 'curl'
<tool>
lib558
</tool>
<name>
libtest memory tracking operational
</name>
<command>
nothing
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<file name="log/memdump" mode="text">
MEM ../../../tests/libtest/lib558.c: malloc()
MEM ../../../tests/libtest/lib558.c: free()
MEM ../../lib/escape.c: malloc()
MEM ../../lib/escape.c: realloc()
MEM ../../lib/escape.c: realloc()
MEM ../../lib/escape.c: free()
</file>
<stripfile>
s/ =.*//
s/\(.*\)/()/
s/:\d+/:/
</stripfile>
</verify>
</testcase>

43
tests/data/test96 Normal file
View File

@ -0,0 +1,43 @@
<testcase>
<info>
<keywords>
TrackMemory
</keywords>
</info>
#
# Server-side
<reply>
</reply>
# Client-side
<client>
<server>
none
</server>
<features>
TrackMemory
</features>
<name>
curl memory tracking operational
</name>
<command>
--version
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<file name="log/memdump" mode="text">
MEM ../../src/tool_paramhlp.c
MEM ../../src/tool_cfgable.c
</file>
<stripfile>
$_ = '' if (($_ !~ /tool_paramhlp/) && ($_ !~ /tool_cfgable/))
s/:\d+.*//
</stripfile>
</verify>
</testcase>

View File

@ -11,21 +11,18 @@ WARNLESS = ../../lib/warnless.c ../../lib/warnless.h
SUPPORTFILES = first.c test.h
# These are all libcurl test programs
noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \
lib500 lib501 lib502 lib503 lib504 lib505 lib506 lib507 lib508 lib509 \
lib510 lib511 lib512 lib513 lib514 lib515 lib516 lib517 lib518 lib519 \
lib520 lib521 lib523 lib524 lib525 lib526 lib527 lib529 \
lib530 lib532 lib533 lib536 lib537 lib539 \
lib540 lib541 lib542 lib543 lib544 lib545 lib547 lib548 lib549 \
lib552 lib553 lib554 lib555 lib556 lib557 \
lib560 lib562 lib564 lib565 lib566 lib567 lib568 lib569 \
lib570 lib571 lib572 lib573 lib574 lib575 lib576 lib578 lib579 \
lib582 lib583 lib585 lib586 lib587 \
lib590 lib591 lib597 lib598 lib599 \
\
lib1500 lib1501 lib1502 lib1503 lib1504 lib1505 lib1506 lib1507 lib1508 \
lib1900 \
lib2033
noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \
lib500 lib501 lib502 lib503 lib504 lib505 lib506 lib507 lib508 lib509 \
lib510 lib511 lib512 lib513 lib514 lib515 lib516 lib517 lib518 lib519 \
lib520 lib521 lib523 lib524 lib525 lib526 lib527 lib529 lib530 lib532 \
lib533 lib536 lib537 lib539 lib540 lib541 lib542 lib543 lib544 lib545 \
lib547 lib548 lib549 lib552 lib553 lib554 lib555 lib556 lib557 lib558 \
lib560 lib562 lib564 lib565 lib566 lib567 lib568 lib569 lib570 \
lib571 lib572 lib573 lib574 lib575 lib576 lib578 lib579 lib582 \
lib583 lib585 lib586 lib587 lib590 lib591 lib597 lib598 lib599 \
lib1500 lib1501 lib1502 lib1503 lib1504 lib1505 lib1506 lib1507 lib1508 \
lib1900 \
lib2033
chkhostname_SOURCES = chkhostname.c ../../lib/curl_gethostname.c
chkhostname_LDADD = @CURL_NETWORK_LIBS@
@ -201,6 +198,9 @@ lib556_CPPFLAGS = $(AM_CPPFLAGS)
lib557_SOURCES = lib557.c $(SUPPORTFILES)
lib557_CPPFLAGS = $(AM_CPPFLAGS)
lib558_SOURCES = lib558.c $(SUPPORTFILES)
lib558_CPPFLAGS = $(AM_CPPFLAGS)
lib560_SOURCES = lib560.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib560_LDADD = $(TESTUTIL_LIBS)
lib560_CPPFLAGS = $(AM_CPPFLAGS)

53
tests/libtest/lib558.c Normal file
View File

@ -0,0 +1,53 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "test.h"
#include "memdebug.h"
int test(char *URL)
{
unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
CURLcode res = CURLE_OK;
char *ptr = NULL;
int asize;
(void)URL; /* we don't use this */
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
return TEST_ERR_MAJOR_BAD;
}
ptr = malloc(558);
Curl_safefree(ptr);
asize = (int)sizeof(a);
ptr = curl_easy_escape(NULL, (char *)a, asize);
if(ptr)
curl_free(ptr);
curl_global_cleanup();
return (int)res;
}

View File

@ -176,8 +176,8 @@ my $TESTCASES="all";
my $perl="perl -I$srcdir";
my $server_response_maxtime=13;
my $debug_build=0; # curl built with --enable-debug
my $curl_debug=0; # curl built with --enable-curldebug (memory tracking)
my $debug_build=0; # built debug enabled (--enable-debug)
my $has_memory_tracking=0; # built with memory tracking (--enable-curldebug)
my $libtool;
# name of the file that the memory debugging creates:
@ -2368,8 +2368,8 @@ sub checksystem {
elsif($_ =~ /^Features: (.*)/i) {
$feat = $1;
if($feat =~ /TrackMemory/i) {
# curl was built with --enable-curldebug (memory tracking)
$curl_debug = 1;
# built with memory tracking support (--enable-curldebug)
$has_memory_tracking = 1;
}
if($feat =~ /debug/i) {
# curl was built with --enable-debug
@ -2487,8 +2487,9 @@ sub checksystem {
}
}
if(!$curl_debug && $torture) {
die "can't run torture tests since curl was not built with curldebug";
if(!$has_memory_tracking && $torture) {
die "can't run torture tests since curl was built without ".
"TrackMemory feature (--enable-curldebug)";
}
$has_shared = `sh $CURLCONFIG --built-shared`;
@ -2511,7 +2512,7 @@ sub checksystem {
logmsg sprintf("* Server SSL: %8s", $stunnel?"ON ":"OFF");
logmsg sprintf(" libcurl SSL: %s\n", $ssl_version?"ON ":"OFF");
logmsg sprintf("* debug build: %8s", $debug_build?"ON ":"OFF");
logmsg sprintf(" track memory: %s\n", $curl_debug?"ON ":"OFF");
logmsg sprintf(" track memory: %s\n", $has_memory_tracking?"ON ":"OFF");
logmsg sprintf("* valgrind: %8s", $valgrind?"ON ":"OFF");
logmsg sprintf(" HTTP IPv6 %s\n", $http_ipv6?"ON ":"OFF");
logmsg sprintf("* FTP IPv6 %8s", $ftp_ipv6?"ON ":"OFF");
@ -2790,6 +2791,11 @@ sub singletest {
next;
}
}
elsif($f eq "TrackMemory") {
if($has_memory_tracking) {
next;
}
}
elsif($f eq "large_file") {
if($large_file) {
next;
@ -3064,7 +3070,7 @@ sub singletest {
# there was no command given, use something silly
$cmd="-";
}
if($curl_debug) {
if($has_memory_tracking) {
unlink($memdump);
}
@ -3659,9 +3665,9 @@ sub singletest {
return 1;
}
if($curl_debug) {
if($has_memory_tracking) {
if(! -f $memdump) {
logmsg "\n** ALERT! memory debugging with no output file?\n"
logmsg "\n** ALERT! memory tracking with no output file?\n"
if(!$cmdtype eq "perl");
}
else {

View File

@ -6,7 +6,7 @@ UNITFILES = curlcheck.h \
# These are all unit test programs
UNITPROGS = unit1300 unit1301 unit1302 unit1303 unit1304 unit1305 unit1307 \
unit1308 unit1309
unit1308 unit1309 unit1330
unit1300_SOURCES = unit1300.c $(UNITFILES)
unit1300_CPPFLAGS = $(AM_CPPFLAGS)
@ -35,3 +35,6 @@ unit1308_CPPFLAGS = $(AM_CPPFLAGS)
unit1309_SOURCES = unit1309.c $(UNITFILES)
unit1309_CPPFLAGS = $(AM_CPPFLAGS)
unit1330_SOURCES = unit1330.c $(UNITFILES)
unit1330_CPPFLAGS = $(AM_CPPFLAGS)

41
tests/unit/unit1330.c Normal file
View File

@ -0,0 +1,41 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "curlcheck.h"
#include "memdebug.h"
static CURLcode unit_setup(void)
{
return CURLE_OK;
}
static void unit_stop(void)
{
}
UNITTEST_START
char *ptr = malloc(1330);
Curl_safefree(ptr);
UNITTEST_STOP