Deleted Added
full compact
test_write_disk_symlink.c (228763) test_write_disk_symlink.c (232153)
1/*-
2 * Copyright (c) 2003-2007 Tim Kientzle
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25#include "test.h"
1/*-
2 * Copyright (c) 2003-2007 Tim Kientzle
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25#include "test.h"
26__FBSDID("$FreeBSD: head/contrib/libarchive/libarchive/test/test_write_disk_symlink.c 228763 2011-12-21 11:13:29Z mm $");
26__FBSDID("$FreeBSD: head/contrib/libarchive/libarchive/test/test_write_disk_symlink.c 232153 2012-02-25 10:58:02Z mm $");
27
28/*
29 * Exercise symlink recreation.
30 */
31DEFINE_TEST(test_write_disk_symlink)
32{
33 static const char data[]="abcdefghijklmnopqrstuvwxyz";
34 struct archive *ad;

--- 59 unchanged lines hidden (view full) ---

94 archive_entry_set_mode(ae, AE_IFREG | 0755);
95 archive_entry_set_size(ae, sizeof(data));
96 assertEqualIntA(ad, 0, archive_write_header(ad, ae));
97 assertEqualInt(sizeof(data),
98 archive_write_data(ad, data, sizeof(data)));
99 assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
100 archive_entry_free(ae);
101
27
28/*
29 * Exercise symlink recreation.
30 */
31DEFINE_TEST(test_write_disk_symlink)
32{
33 static const char data[]="abcdefghijklmnopqrstuvwxyz";
34 struct archive *ad;

--- 59 unchanged lines hidden (view full) ---

94 archive_entry_set_mode(ae, AE_IFREG | 0755);
95 archive_entry_set_size(ae, sizeof(data));
96 assertEqualIntA(ad, 0, archive_write_header(ad, ae));
97 assertEqualInt(sizeof(data),
98 archive_write_data(ad, data, sizeof(data)));
99 assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
100 archive_entry_free(ae);
101
102 assertEqualInt(ARCHIVE_OK, archive_write_finish(ad));
102 assertEqualInt(ARCHIVE_OK, archive_write_free(ad));
103
104 /* Test the entries on disk. */
105
106 /* Test #1 */
107 assertIsReg("link1a", -1);
108 assertFileSize("link1a", sizeof(data));
109 assertFileNLinks("link1a", 1);
110 assertIsSymlink("link1b", "link1a");
111
112 /* Test #2: Should produce identical results to test #1 */
113 assertIsReg("link2a", -1);
114 assertFileSize("link2a", sizeof(data));
115 assertFileNLinks("link2a", 1);
116 assertIsSymlink("link2b", "link2a");
117}
103
104 /* Test the entries on disk. */
105
106 /* Test #1 */
107 assertIsReg("link1a", -1);
108 assertFileSize("link1a", sizeof(data));
109 assertFileNLinks("link1a", 1);
110 assertIsSymlink("link1b", "link1a");
111
112 /* Test #2: Should produce identical results to test #1 */
113 assertIsReg("link2a", -1);
114 assertFileSize("link2a", sizeof(data));
115 assertFileNLinks("link2a", 1);
116 assertIsSymlink("link2b", "link2a");
117}