test_option_b64encode.c revision 248616
1213136Spjd/*- 2213136Spjd * Copyright (c) 2003-2007 Tim Kientzle 3213136Spjd * Copyright (c) 2012 Michihiro NAKAJIMA 4213136Spjd * All rights reserved. 5213136Spjd * 6213136Spjd * Redistribution and use in source and binary forms, with or without 7213136Spjd * modification, are permitted provided that the following conditions 8213136Spjd * are met: 9213136Spjd * 1. Redistributions of source code must retain the above copyright 10213136Spjd * notice, this list of conditions and the following disclaimer. 11213136Spjd * 2. Redistributions in binary form must reproduce the above copyright 12213136Spjd * notice, this list of conditions and the following disclaimer in the 13213136Spjd * documentation and/or other materials provided with the distribution. 14213136Spjd * 15213136Spjd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 16213136Spjd * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17213136Spjd * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18213136Spjd * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 19213136Spjd * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20213136Spjd * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21213136Spjd * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22213136Spjd * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23213136Spjd * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24213136Spjd * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25213136Spjd */ 26213136Spjd#include "test.h" 27213136Spjd__FBSDID("$FreeBSD$"); 28213136Spjd 29213136SpjdDEFINE_TEST(test_option_b64encode) 30213136Spjd{ 31213136Spjd char *p; 32213136Spjd size_t s; 33213136Spjd 34213136Spjd /* Create a file. */ 35213136Spjd assertMakeFile("f", 0644, "a"); 36213136Spjd 37213136Spjd /* Archive it with compress compression and uuencode. */ 38219702Sae assertEqualInt(0, 39213136Spjd systemf("%s -cf - -Z --b64encode f >archive.out 2>archive.err", 40213136Spjd testprog)); 41213136Spjd /* Check that the archive file has an uuencode signature. */ 42213136Spjd p = slurpfile(&s, "archive.out"); 43213136Spjd assert(s > 2); 44213136Spjd assertEqualMem(p, "begin-base64 644", 16); 45213136Spjd 46213136Spjd /* Archive it with uuencode only. */ 47213136Spjd assertEqualInt(0, 48213136Spjd systemf("%s -cf - --b64encode f >archive.out 2>archive.err", 49213136Spjd testprog)); 50213136Spjd /* Check that the archive file has an uuencode signature. */ 51213136Spjd p = slurpfile(&s, "archive.out"); 52213136Spjd assert(s > 2); 53213136Spjd assertEqualMem(p, "begin-base64 644", 16); 54213136Spjd} 55213136Spjd