Path: blob/main/contrib/libarchive/tar/test/test_option_exclude_vcs.c
39536 views
/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2019 Martin Matuska4* All rights reserved.5*/6#include "test.h"78DEFINE_TEST(test_option_exclude_vcs)9{10assertUmask(0);11assertMakeDir("in", 0755);12assertChdir("in");13assertMakeFile("file", 0644, "");14assertMakeDir("dir", 0755);15assertMakeDir("CVS", 0755);16assertMakeFile("CVS/fileattr", 0644, "");17assertMakeFile(".cvsignore", 0644, "");18assertMakeDir("RCS", 0755);19assertMakeFile("RCS/somefile", 0655, "");20assertMakeDir("SCCS", 0755);21assertMakeFile("SCCS/somefile", 0655, "");22assertMakeDir(".svn", 0755);23assertMakeFile(".svn/format", 0655, "");24assertMakeDir(".git", 0755);25assertMakeFile(".git/config", 0655, "");26assertMakeFile(".gitignore", 0644, "");27assertMakeFile(".gitattributes", 0644, "");28assertMakeFile(".gitmodules", 0644, "");29assertMakeDir(".arch-ids", 0755);30assertMakeFile(".arch-ids/somefile", 0644, "");31assertMakeDir("{arch}", 0755);32assertMakeFile("{arch}/somefile", 0644, "");33assertMakeFile("=RELEASE-ID", 0644, "");34assertMakeFile("=meta-update", 0644, "");35assertMakeFile("=update", 0644, "");36assertMakeDir(".bzr", 0755);37assertMakeDir(".bzr/checkout", 0755);38assertMakeFile(".bzrignore", 0644, "");39assertMakeFile(".bzrtags", 0644, "");40assertMakeDir(".hg", 0755);41assertMakeFile(".hg/dirstate", 0644, "");42assertMakeFile(".hgignore", 0644, "");43assertMakeFile(".hgtags", 0644, "");44assertMakeDir("_darcs", 0755);45assertMakeFile("_darcs/format", 0644, "");46assertChdir("..");4748assertEqualInt(0, systemf("%s -c -C in -f included.tar .", testprog));49assertEqualInt(0,50systemf("%s -c --exclude-vcs -C in -f excluded.tar .", testprog));5152/* No flags, archive with vcs files */53assertMakeDir("vcs-noexclude", 0755);54assertEqualInt(0, systemf("%s -x -C vcs-noexclude -f included.tar",55testprog));56assertChdir("vcs-noexclude");57assertFileExists("file");58assertIsDir("dir", 0755);59assertIsDir("CVS", 0755);60assertFileExists("CVS/fileattr");61assertFileExists(".cvsignore");62assertIsDir("RCS", 0755);63assertFileExists("RCS/somefile");64assertIsDir("SCCS", 0755);65assertFileExists("SCCS/somefile");66assertIsDir(".svn", 0755);67assertFileExists(".svn/format");68assertIsDir(".git", 0755);69assertFileExists(".git/config");70assertFileExists(".gitignore");71assertFileExists(".gitattributes");72assertFileExists(".gitmodules");73assertIsDir(".arch-ids", 0755);74assertFileExists(".arch-ids/somefile");75assertIsDir("{arch}", 0755);76assertFileExists("{arch}/somefile");77assertFileExists("=RELEASE-ID");78assertFileExists("=meta-update");79assertFileExists("=update");80assertIsDir(".bzr", 0755);81assertIsDir(".bzr/checkout", 0755);82assertFileExists(".bzrignore");83assertFileExists(".bzrtags");84assertIsDir(".hg", 0755);85assertFileExists(".hg/dirstate");86assertFileExists(".hgignore");87assertFileExists(".hgtags");88assertIsDir("_darcs", 0755);89assertFileExists("_darcs/format");90assertChdir("..");9192/* --exclude-vcs, archive with vcs files */93assertMakeDir("vcs-exclude", 0755);94assertEqualInt(0,95systemf("%s -x --exclude-vcs -C vcs-exclude -f included.tar", testprog));96assertChdir("vcs-exclude");97assertFileExists("file");98assertIsDir("dir", 0755);99assertFileNotExists("CVS");100assertFileNotExists("CVS/fileattr");101assertFileNotExists(".cvsignore");102assertFileNotExists("RCS");103assertFileNotExists("RCS/somefile");104assertFileNotExists("SCCS");105assertFileNotExists("SCCS/somefile");106assertFileNotExists(".svn");107assertFileNotExists(".svn/format");108assertFileNotExists(".git");109assertFileNotExists(".git/config");110assertFileNotExists(".gitignore");111assertFileNotExists(".gitattributes");112assertFileNotExists(".gitmodules");113assertFileNotExists(".arch-ids");114assertFileNotExists(".arch-ids/somefile");115assertFileNotExists("{arch}");116assertFileNotExists("{arch}/somefile");117assertFileNotExists("=RELEASE-ID");118assertFileNotExists("=meta-update");119assertFileNotExists("=update");120assertFileNotExists(".bzr");121assertFileNotExists(".bzr/checkout");122assertFileNotExists(".bzrignore");123assertFileNotExists(".bzrtags");124assertFileNotExists(".hg");125assertFileNotExists(".hg/dirstate");126assertFileNotExists(".hgignore");127assertFileNotExists(".hgtags");128assertFileNotExists("_darcs");129assertFileNotExists("_darcs/format");130assertChdir("..");131132/* --exclude-vcs, archive without vcs files */133assertMakeDir("novcs-exclude", 0755);134assertEqualInt(0,135systemf("%s -x --exclude-vcs -C novcs-exclude -f excluded.tar",136testprog));137assertChdir("novcs-exclude");138assertFileExists("file");139assertIsDir("dir", 0755);140assertFileNotExists("CVS");141assertFileNotExists("CVS/fileattr");142assertFileNotExists(".cvsignore");143assertFileNotExists("RCS");144assertFileNotExists("RCS/somefile");145assertFileNotExists("SCCS");146assertFileNotExists("SCCS/somefile");147assertFileNotExists(".svn");148assertFileNotExists(".svn/format");149assertFileNotExists(".git");150assertFileNotExists(".git/config");151assertFileNotExists(".gitignore");152assertFileNotExists(".gitattributes");153assertFileNotExists(".gitmodules");154assertFileNotExists(".arch-ids");155assertFileNotExists(".arch-ids/somefile");156assertFileNotExists("{arch}");157assertFileNotExists("{arch}/somefile");158assertFileNotExists("=RELEASE-ID");159assertFileNotExists("=meta-update");160assertFileNotExists("=update");161assertFileNotExists(".bzr");162assertFileNotExists(".bzr/checkout");163assertFileNotExists(".bzrignore");164assertFileNotExists(".bzrtags");165assertFileNotExists(".hg");166assertFileNotExists(".hg/dirstate");167assertFileNotExists(".hgignore");168assertFileNotExists(".hgtags");169assertFileNotExists("_darcs");170assertFileNotExists("_darcs/format");171assertChdir("..");172173/* No flags, archive without vcs files */174assertMakeDir("novcs-noexclude", 0755);175assertEqualInt(0,176systemf("%s -x -C novcs-noexclude -f excluded.tar", testprog));177assertChdir("novcs-noexclude");178assertFileExists("file");179assertIsDir("dir", 0755);180assertFileNotExists("CVS");181assertFileNotExists("CVS/fileattr");182assertFileNotExists(".cvsignore");183assertFileNotExists("RCS");184assertFileNotExists("RCS/somefile");185assertFileNotExists("SCCS");186assertFileNotExists("SCCS/somefile");187assertFileNotExists(".svn");188assertFileNotExists(".svn/format");189assertFileNotExists(".git");190assertFileNotExists(".git/config");191assertFileNotExists(".gitignore");192assertFileNotExists(".gitattributes");193assertFileNotExists(".gitmodules");194assertFileNotExists(".arch-ids");195assertFileNotExists(".arch-ids/somefile");196assertFileNotExists("{arch}");197assertFileNotExists("{arch}/somefile");198assertFileNotExists("=RELEASE-ID");199assertFileNotExists("=meta-update");200assertFileNotExists("=update");201assertFileNotExists(".bzr");202assertFileNotExists(".bzr/checkout");203assertFileNotExists(".bzrignore");204assertFileNotExists(".bzrtags");205assertFileNotExists(".hg");206assertFileNotExists(".hg/dirstate");207assertFileNotExists(".hgignore");208assertFileNotExists(".hgtags");209assertFileNotExists("_darcs");210assertFileNotExists("_darcs/format");211}212213214