1#!/bin/sh
2#
3# Run a simple backup  using the compressed option
4#   then restore it.
5#
6TestName="lz4hc-test"
7JobName=lz4hc
8. scripts/functions
9
10#
11# See if library is linked against libfastlz
12#
13if ! check_linked_against fastlz; then
14   echo "$TestName skipped: not linked for fastlz compression"
15   exit 0
16fi
17
18
19
20scripts/cleanup
21scripts/copy-test-confs
22
23# Directory to backup.
24# This directory will be created by setup_data().
25BackupDirectory="${tmp}/data"
26
27# Use a tgz to setup data to be backuped.
28# Data will be placed at "${tmp}/data/".
29setup_data data/small.tgz
30
31# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
32echo "${BackupDirectory}" >${tmp}/file-list
33
34
35start_test
36
37cat <<END_OF_DATA >${cwd}/tmp/bconcmds
38@$out /dev/null
39messages
40@$out ${cwd}/tmp/log1.out
41status all
42status all
43messages
44label storage=File volume=TestVolume001
45run job=lz4hcTest storage=File yes
46wait
47messages
48@#
49@# now do a restore
50@#
51@$out ${cwd}/tmp/log2.out
52restore where=${cwd}/tmp/bareos-restores select storage=File
53unmark *
54mark *
55done
56yes
57wait
58messages
59quit
60END_OF_DATA
61
62run_bareos
63check_for_zombie_jobs storage=File
64stop_bareos
65
66check_two_logs
67check_restore_diff
68grep " Software Compression" ${cwd}/tmp/log1.out | grep "%" 2>&1 1>/dev/null
69if [ $? != 0 ] ; then
70   echo "  !!!!! No compression !!!!!"
71   bstat=1
72fi
73end_test
74