1#!/bin/sh 2# 3# Run test-plugin-fd. Note, this plugin is for testing 4# new features and probably should not be run in normal 5# testing 6# 7TestName="test-plugin-test" 8JobName=TestPluginTest 9. scripts/functions 10 11# Build and install the test plugin 12cd ${cwd}/build/src/plugins/fd 13make 14make install-test-plugin 15cd ${cwd} 16 17scripts/cleanup 18scripts/copy-plugin-confs 19file=encrypt-bug.jpg 20 21# Directory to backup. 22# This directory will be created by setup_data(). 23BackupDirectory="${tmp}/data" 24 25# Use a tgz to setup data to be backuped. 26# Data will be placed at "${tmp}/data/". 27setup_data data/small.tgz 28 29# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list". 30echo "${BackupDirectory}" >${tmp}/file-list 31 32 33start_test 34 35cat <<END_OF_DATA >${cwd}/tmp/bconcmds 36@$out /dev/null 37messages 38@$out ${cwd}/tmp/log1.out 39label storage=File1 volume=TestVolume001 40setdebug level=100 client=$CLIENT 41estimate job=$JobName level=Full 42@#setdebug level=150 client=$CLIENT 43@#setdebug level=150 storage=File1 44run job=$JobName storage=File1 yes 45wait 46status client=$CLIENT 47messages 48quit 49END_OF_DATA 50 51 52run_bareos 53 54cat <<END_OF_DATA >${cwd}/tmp/bconcmds 55messages 56@# 57@# now do a restore 58@# 59@$out ${cwd}/tmp/log2.out 60setdebug level=50 client=$CLIENT 61restore where=${cwd}/tmp select all storage=File1 done 62yes 63wait 64setdebug level=0 client=$CLIENT 65messages 66quit 67END_OF_DATA 68 69run_bconsole 70 71stop_bareos 72 73exit 0 74 75# ****FIXME**** test if the restore of the two files is OK 76 77# 78# Remove plugin so we can try the restore without the plugin 79# 80mv -f ${cwd}/bin/plugins/test-plugin-fd.so ${cwd}/bin/plugins/test-plugin-fd.sox 81 82cat <<END_OF_DATA >${cwd}/tmp/bconcmds 83@$out ${cwd}/tmp/log2.out 84@# remove plugin 85@exec "sh -c 'rm -f ${cwd}/bin/plugins/test-plugin-fd.so'" 86@# 87@# now do a restore without the plugin 88@# 89@$out ${cwd}/tmp/log2.out 90@#setdebug level=50 client=$CLIENT 91restore where=${cwd}/tmp select all storage=File1 done 92yes 93wait 94messages 95quit 96END_OF_DATA 97 98run_bareos -d50 99run_bconsole 100 101check_for_zombie_jobs storage=File1 102stop_bareos 103# 104# Restore plugin 105# 106mv -f ${cwd}/bin/plugins/test-plugin-fd.sox ${cwd}/bin/plugins/test-plugin-fd.so 107 108check_two_logs 109# 110# ****FIXME**** test that all three files are restored correctly 111# 112diff ${cwd}/${file} ${cwd}/tmp/${file} 113dstat=$? 114end_test 115