summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/libarchive-fix-lzo-test-case.patch
blob: ffdc0db922c0ebbd550e62b66cf687119b5444a7 (about) (plain)
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
Description: This patch fixes test cases for LZO write support in various
 architectures, such as armhf. Writing a certain amount of files would
 cause the LZO compressor level 9 to produce a bigger archive than the
 default compressor level.
Author: Andres Mejia <amejia@debian.org>

--- a/libarchive/test/test_write_filter_lzop.c
+++ b/libarchive/test/test_write_filter_lzop.c
@@ -39,7 +39,7 @@
 	size_t buffsize, datasize;
 	char path[16];
 	size_t used1, used2;
-	int i, r, use_prog = 0;
+	int i, r, use_prog = 0, filecount;
 
 	assert((a = archive_write_new()) != NULL);
 	r = archive_write_add_filter_lzop(a);
@@ -58,9 +58,10 @@
 
 	datasize = 10000;
 	assert(NULL != (data = (char *)calloc(1, datasize)));
+	filecount = 10;
 
 	/*
-	 * Write a 100 files and read them all back.
+	 * Write a filecount files and read them all back.
 	 */
 	assert((a = archive_write_new()) != NULL);
 	assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a));
@@ -77,7 +78,7 @@
 	assert((ae = archive_entry_new()) != NULL);
 	archive_entry_set_filetype(ae, AE_IFREG);
 	archive_entry_set_size(ae, datasize);
-	for (i = 0; i < 100; i++) {
+	for (i = 0; i < filecount; i++) {
 		sprintf(path, "file%03d", i);
 		archive_entry_copy_pathname(ae, path);
 		assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
@@ -97,7 +98,7 @@
 	} else {
 		assertEqualIntA(a, ARCHIVE_OK,
 		    archive_read_open_memory(a, buff, used1));
-		for (i = 0; i < 100; i++) {
+		for (i = 0; i < filecount; i++) {
 			sprintf(path, "file%03d", i);
 			if (!assertEqualInt(ARCHIVE_OK,
 				archive_read_next_header(a, &ae)))
@@ -133,7 +134,7 @@
 	    archive_write_set_options(a, "lzop:compression-level=9"));
 	assertEqualIntA(a, ARCHIVE_OK,
 	    archive_write_open_memory(a, buff, buffsize, &used2));
-	for (i = 0; i < 100; i++) {
+	for (i = 0; i < filecount; i++) {
 		sprintf(path, "file%03d", i);
 		assert((ae = archive_entry_new()) != NULL);
 		archive_entry_copy_pathname(ae, path);
@@ -161,7 +162,7 @@
 		    archive_read_support_filter_all(a));
 		assertEqualIntA(a, ARCHIVE_OK,
 		    archive_read_open_memory(a, buff, used2));
-		for (i = 0; i < 100; i++) {
+		for (i = 0; i < filecount; i++) {
 			sprintf(path, "file%03d", i);
 			if (!assertEqualInt(ARCHIVE_OK,
 				archive_read_next_header(a, &ae)))
@@ -186,7 +187,7 @@
 	    archive_write_set_filter_option(a, NULL, "compression-level", "1"));
 	assertEqualIntA(a, ARCHIVE_OK,
 	    archive_write_open_memory(a, buff, buffsize, &used2));
-	for (i = 0; i < 100; i++) {
+	for (i = 0; i < filecount; i++) {
 		sprintf(path, "file%03d", i);
 		assert((ae = archive_entry_new()) != NULL);
 		archive_entry_copy_pathname(ae, path);
@@ -216,7 +217,7 @@
 	} else {
 		assertEqualIntA(a, ARCHIVE_OK,
 		    archive_read_open_memory(a, buff, used2));
-		for (i = 0; i < 100; i++) {
+		for (i = 0; i < filecount; i++) {
 			sprintf(path, "file%03d", i);
 			if (!assertEqualInt(ARCHIVE_OK,
 				archive_read_next_header(a, &ae)))