main.c (302408) | main.c (305188) |
---|---|
1/* 2 * Copyright (c) 2003-2009 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 --- 46 unchanged lines hidden (view full) --- 55 56/* 57 * This same file is used pretty much verbatim for all test harnesses. 58 * 59 * The next few lines are the only differences. 60 * TODO: Move this into a separate configuration header, have all test 61 * suites share one copy of this file. 62 */ | 1/* 2 * Copyright (c) 2003-2009 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 --- 46 unchanged lines hidden (view full) --- 55 56/* 57 * This same file is used pretty much verbatim for all test harnesses. 58 * 59 * The next few lines are the only differences. 60 * TODO: Move this into a separate configuration header, have all test 61 * suites share one copy of this file. 62 */ |
63__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/test/main.c 302294 2016-06-30 08:51:50Z mm $"); | 63__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/test/main.c 305188 2016-09-01 07:53:59Z mm $"); |
64#define KNOWNREF "test_compat_gtar_1.tar.uu" 65#define ENVBASE "LIBARCHIVE" /* Prefix for environment variables. */ 66#undef PROGRAM /* Testing a library, not a program. */ 67#define LIBRARY "libarchive" 68#define EXTRA_DUMP(x) archive_error_string((struct archive *)(x)) 69#define EXTRA_ERRNO(x) archive_errno((struct archive *)(x)) 70#define EXTRA_VERSION archive_version_details() 71 --- 1363 unchanged lines hidden (view full) --- 1435 if (r == 0 && filesize == size) 1436 return (1); 1437 failure_start(file, line, "File %s has size %ld, expected %ld", 1438 pathname, (long)filesize, (long)size); 1439 failure_finish(NULL); 1440 return (0); 1441} 1442 | 64#define KNOWNREF "test_compat_gtar_1.tar.uu" 65#define ENVBASE "LIBARCHIVE" /* Prefix for environment variables. */ 66#undef PROGRAM /* Testing a library, not a program. */ 67#define LIBRARY "libarchive" 68#define EXTRA_DUMP(x) archive_error_string((struct archive *)(x)) 69#define EXTRA_ERRNO(x) archive_errno((struct archive *)(x)) 70#define EXTRA_VERSION archive_version_details() 71 --- 1363 unchanged lines hidden (view full) --- 1435 if (r == 0 && filesize == size) 1436 return (1); 1437 failure_start(file, line, "File %s has size %ld, expected %ld", 1438 pathname, (long)filesize, (long)size); 1439 failure_finish(NULL); 1440 return (0); 1441} 1442 |
1443/* Verify mode of 'pathname'. */ 1444int 1445assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) 1446{ 1447 int mode; 1448 int r; 1449 1450 assertion_count(file, line); 1451#if defined(_WIN32) && !defined(__CYGWIN__) 1452 failure_start(file, line, "assertFileMode not yet implemented for Windows"); 1453#else 1454 { 1455 struct stat st; 1456 r = lstat(pathname, &st); 1457 mode = (int)(st.st_mode & 0777); 1458 } 1459 if (r == 0 && mode == expected_mode) 1460 return (1); 1461 failure_start(file, line, "File %s has mode %o, expected %o", 1462 pathname, mode, expected_mode); 1463#endif 1464 failure_finish(NULL); 1465 return (0); 1466} 1467 |
|
1443/* Assert that 'pathname' is a dir. If mode >= 0, verify that too. */ 1444int 1445assertion_is_dir(const char *file, int line, const char *pathname, int mode) 1446{ 1447 struct stat st; 1448 int r; 1449 1450#if defined(_WIN32) && !defined(__CYGWIN__) --- 1546 unchanged lines hidden --- | 1468/* Assert that 'pathname' is a dir. If mode >= 0, verify that too. */ 1469int 1470assertion_is_dir(const char *file, int line, const char *pathname, int mode) 1471{ 1472 struct stat st; 1473 int r; 1474 1475#if defined(_WIN32) && !defined(__CYGWIN__) --- 1546 unchanged lines hidden --- |