~dricottone/my-utils

ref: b701c9dbf213ffad7dad40fe5001180d17c2c5b0 my-utils/archives/test/mktar-batch.bats -rw-r--r-- 5.4 KiB
b701c9dbDominic Ricottone Update usage message 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/usr/bin/env bats
bats_require_minimum_version 1.5.0

setup() {
  mkdir -p test/static test/output
  printf "[1]\n[2]\n[3]\n\n" > test/static/compression_target.txt
}

teardown() {
  rm -rf test/static test/output
}

@test "mktar-batch none" {
  run --separate-stderr mktar-batch --compress=none --name test/output/archive.tar test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat test/output/archive.tar | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch none gpg" {
  run --separate-stderr mktar-batch --compress=none --encrypt=gpg --passphrase test123 --name test/output/archive.tar.gpg test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat --passphrase test123 test/output/archive.tar.gpg | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch none age" {
  run --separate-stderr mktar-batch --compress=none --encrypt=age --passphrase test123 --name test/output/archive.tar.age test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat --passphrase test123 test/output/archive.tar.age | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch gzip" {
  run --separate-stderr mktar-batch --compress=gzip --name test/output/archive.tar.gz test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat test/output/archive.tar.gz | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch gzip gpg" {
  run --separate-stderr mktar-batch --compress=gzip --encrypt=gpg --passphrase test123 --name test/output/archive.tar.gz.gpg test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat --passphrase test123 test/output/archive.tar.gz.gpg | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch gzip age" {
  run --separate-stderr mktar-batch --compress=gzip --encrypt=age --passphrase test123 --name test/output/archive.tar.gz.age test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat --passphrase test123 test/output/archive.tar.gz.age | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch xz" {
  run --separate-stderr mktar-batch --compress=xz --name test/output/archive.tar.xz test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat test/output/archive.tar.xz | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch xz gpg" {
  run --separate-stderr mktar-batch --compress=xz --encrypt=gpg --passphrase test123 --name test/output/archive.tar.xz.gpg test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat --passphrase test123 test/output/archive.tar.xz.gpg | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch xz age" {
  run --separate-stderr mktar-batch --compress=xz --encrypt=age --passphrase test123 --name test/output/archive.tar.xz.age test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat --passphrase test123 test/output/archive.tar.xz.age | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch zstd" {
  run --separate-stderr mktar-batch --compress=zstd --name test/output/archive.tar.zst test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat test/output/archive.tar.zst | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch zstd gpg" {
  run --separate-stderr mktar-batch --compress=zstd --encrypt=gpg --passphrase test123 --name test/output/archive.tar.zst.gpg test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat --passphrase test123 test/output/archive.tar.zst.gpg | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch zstd age" {
  run --separate-stderr mktar-batch --compress=zstd --encrypt=age --passphrase test123 --name test/output/archive.tar.zst.age test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat --passphrase test123 test/output/archive.tar.zst.age | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch bzip2" {
  run --separate-stderr mktar-batch --compress=bzip2 --name test/output/archive.tar.bz2 test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat test/output/archive.tar.bz2 | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch bzip2 gpg" {
  run --separate-stderr mktar-batch --compress=bzip2 --encrypt=gpg --passphrase test123 --name test/output/archive.tar.bz2.gpg test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat --passphrase test123 test/output/archive.tar.bz2.gpg | cmp test/static/compression_target.txt >/dev/null 2>&1
}

@test "mktar-batch bzip2 age" {
  run --separate-stderr mktar-batch --compress=bzip2 --encrypt=age --passphrase test123 --name test/output/archive.tar.bz2.age test/static/compression_target.txt
  [ "$status" -eq 0 ]
  [ "$output" = "" ]
  [ "$stderr" = "" ]
  tarcat --passphrase test123 test/output/archive.tar.bz2.age | cmp test/static/compression_target.txt >/dev/null 2>&1
}