summaryrefslogtreecommitdiffstats
path: root/tests/rscript_set_unset_invalid_var.sh
blob: a428be207baaf90e20fe0d162254787bb8ea8b87 (plain)
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
#!/bin/bash
# Check that invalid variable names are detected.
# Copyright 2017-01-24 by Rainer Gerhards
# This file is part of the rsyslog project, released under ASL 2.0
. ${srcdir:=.}/diag.sh init
generate_conf
add_conf '
template(name="json" type="string" string="%$!%\n")
ruleset(name="rcvr" queue.type="LinkedList") {
	set $@timestamp="test";
	unset $@timestamp2;
	action(type="omfile" file=`echo $RSYSLOG2_OUT_LOG`)
}

action(type="omfile" file=`echo $RSYSLOG_OUT_LOG`)
 
'
startup
injectmsg  0 10
shutdown_when_empty
wait_shutdown

grep "@timestamp"  $RSYSLOG_OUT_LOG > /dev/null
if [ ! $? -eq 0 ]; then
  echo "expected error message on \"@timestamp\" not found, output is:"
  echo "------------------------------------------------------------"
  cat $RSYSLOG_OUT_LOG
  echo "------------------------------------------------------------"
  error_exit 1
fi;

grep "@timestamp2"  $RSYSLOG_OUT_LOG > /dev/null
if [ ! $? -eq 0 ]; then
  echo "expected error message on \"@timestamp2\" not found, output is:"
  echo "------------------------------------------------------------"
  cat $RSYSLOG_OUT_LOG
  echo "------------------------------------------------------------"
  error_exit 1
fi;

exit_test