msabramo/tarcolor — Issue #6: Tests fail when installing on Linux
Author: msabramo
Created: 2012-01-25 17:33:47+00:00
State: open
Labels: bug

```
marca@live-web01:/home/marca/src$ cpanm --verbose App-TarColor-0.002.tar.gz
cpanm (App::cpanminus) 1.5007 on perl 5.014002 built for x86_64-linux
...
# Failed test 'tar tvf test_tar_archive.tgz, no TAR_COLORS set'
# at t/test.t line 24.
# got: 'drwxr-xr-x marca/admin 0 2012-01-15 08:33:06 test_tar_archive/
# brw-r--r-- root/admin 14,0 2012-01-14 09:11:33 test_tar_archive/block_device
# crw-r--r-- root/admin 0,0 2012-01-14 09:10:02 test_tar_archive/char_device
# drwxr-xr-x marca/admin 0 2012-01-14 08:57:45 test_tar_archive/directory/
# -rwxr-xr-x marca/CHEGG\domain users 0 2012-01-14 08:59:49 test_tar_archive/executable
# prw-r--r-- marca/admin 0 2012-01-14 09:01:19 test_tar_archive/fifo
# -rw-r--r-- marca/CHEGG\domain users 0 2012-01-14 08:57:36 test_tar_archive/normal_file
# -rw-r-Sr-- marca/admin 0 2012-01-14 09:48:20 test_tar_archive/setgid_file
# -rwSr--r-- marca/admin 0 2012-01-14 09:47:58 test_tar_archive/setuid_file
# -rw-r--r-T marca/admin 0 2012-01-14 09:17:52 test_tar_archive/sticky_file
# lrwxr-xr-x marca/admin 0 2012-01-15 08:33:06 test_tar_archive/symlink -> normal_file
# '
# expected: 'drwxr-xr-x 12 marca admin 0 Jan 15 08:33 test_tar_archive/
# brw-r--r-- 0 root admin 14,0 Jan 14 09:11 test_tar_archive/block_device
# crw-r--r-- 0 root admin 0,0 Jan 14 09:10 test_tar_archive/char_device
# drwxr-xr-x 2 marca admin 0 Jan 14 08:57 test_tar_archive/directory/
# -rwxr-xr-x 1 marca CHEGG\domain users 0 Jan 14 08:59 test_tar_archive/executable
# prw-r--r-- 1 marca admin 0 Jan 14 09:01 test_tar_archive/fifo
# -rw-r--r-- 1 marca CHEGG\domain users 0 Jan 14 08:57 test_tar_archive/normal_file
# -rw-r-Sr-- 1 marca admin 0 Jan 14 09:48 test_tar_archive/setgid_file
# -rwSr--r-- 1 marca admin 0 Jan 14 09:47 test_tar_archive/setuid_file
# -rw-r--r-T 1 marca admin 0 Jan 14 09:17 test_tar_archive/sticky_file
# lrwxr-xr-x 1 marca admin 0 Jan 15 08:33 test_tar_archive/symlink -> normal_file
# '
...
# Looks like you failed 9 tests of 11.
t/test.t .. Dubious, test returned 9 (wstat 2304, 0x900)
Failed 9/11 subtests

Test Summary Report
-------------------
t/test.t (Wstat: 2304 Tests: 11 Failed: 9)
Failed tests: 1-9
Non-zero exit status: 9
Files=1, Tests=11, 0 wallclock secs ( 0.02 usr 0.02 sys + 0.09 cusr 0.00 csys = 0.13 CPU)
Result: FAIL
Failed 1/1 test programs. 9/11 subtests failed.
make: *** [test_dynamic] Error 9
FAIL
! Installing App-TarColor-0.002.tar.gz failed. See /home/marca/.cpanm/build.log for details.
```

The problem is that the tests execute `tar` and expect BSD tar output (because I developed `tarcolor` on OS X), but Linux `tar` is GNU tar:

```
marca@live-web01:/home/marca/src$ tar --version
tar (GNU tar) 1.15.1
```

The easiest solution I think is to rewrite the tests so that instead of executing `tar`, they operate on output hard-coded into the tests.