Skip to content

Commit 1be9cff

Browse files
committed
Update tests to not break on year change
1 parent e385867 commit 1be9cff

File tree

3 files changed

+31
-22
lines changed

3 files changed

+31
-22
lines changed

tests/difftests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ echo Diff for teststar::
3434
diff tests/files/teststarexlog tests/files/teststar.log
3535

3636
echo Running testrange.log
37-
./logdissect.py -s --outlog=tests/files/testrange.log --range 20170202020202-20170227213200 tests/files/exsyslog tests/files/exmeslog
37+
./logdissect.py -s --outlog=tests/files/testrange.log --range 20180202020202-20180227213200 tests/files/exsyslog tests/files/exmeslog
3838

3939
echo Diff for testrange:
4040
diff tests/files/testrangeexlog tests/files/testrange.log
4141

4242
echo Running testnone.log
43-
./logdissect.py -s --outlog=tests/files/testnone.log --range=20170202020202-20170224213200 tests/files/exsyslog tests/files/exmeslog
43+
./logdissect.py -s --outlog=tests/files/testnone.log --range=20180202020202-20180224213200 tests/files/exsyslog tests/files/exmeslog
4444

4545
echo Diff for testnone:
4646
diff tests/files/testnoneexlog tests/files/testnone.log

tests/files/testjsonexlog

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,158 +1,158 @@
11
[
22
{
3-
"date_stamp": "20170227213046",
3+
"date_stamp": "20180227213046",
44
"raw_text": "Feb 27 21:30:46 shade gnome-shell[22595]: st_widget_get_theme_node called on the widget [0x18ef30a0 ShellGenericContainer \"dash\"] which is not in the stage.",
55
"log_source": "shade",
66
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exmeslog",
77
"source_pid": "22595",
88
"source_process": "gnome-shell"
99
},
1010
{
11-
"date_stamp": "20170227213046",
11+
"date_stamp": "20180227213046",
1212
"raw_text": "Feb 27 21:30:46 shade gnome-shell[22595]: st_widget_get_theme_node called on the widget [0x16899460 ShellGenericContainer \"dash\"] which is not in the stage.",
1313
"log_source": "shade",
1414
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exmeslog",
1515
"source_pid": "22595",
1616
"source_process": "gnome-shell"
1717
},
1818
{
19-
"date_stamp": "20170227213046",
19+
"date_stamp": "20180227213046",
2020
"raw_text": "Feb 27 21:30:46 shade gnome-shell[22595]: st_widget_get_theme_node called on the widget [0x1c635c50 ShellGenericContainer \"dash\"] which is not in the stage.",
2121
"log_source": "shade",
2222
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exmeslog",
2323
"source_pid": "22595",
2424
"source_process": "gnome-shell"
2525
},
2626
{
27-
"date_stamp": "20170227213046",
27+
"date_stamp": "20180227213046",
2828
"raw_text": "Feb 27 21:30:46 shade gnome-shell[22595]: st_widget_get_theme_node called on the widget [0x167935a0 ShellGenericContainer \"dash\"] which is not in the stage.",
2929
"log_source": "shade",
3030
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exmeslog",
3131
"source_pid": "22595",
3232
"source_process": "gnome-shell"
3333
},
3434
{
35-
"date_stamp": "20170227213046",
35+
"date_stamp": "20180227213046",
3636
"raw_text": "Feb 27 21:30:46 shade gnome-shell[22595]: st_widget_get_theme_node called on the widget [0x1b356c50 ShellGenericContainer \"dash\"] which is not in the stage.",
3737
"log_source": "shade",
3838
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exmeslog",
3939
"source_pid": "22595",
4040
"source_process": "gnome-shell"
4141
},
4242
{
43-
"date_stamp": "20170227213046",
43+
"date_stamp": "20180227213046",
4444
"raw_text": "Feb 27 21:30:46 shade gnome-software-service.desktop[22740]: 02:30:46:0245 Gs no app for changed [email protected]",
4545
"log_source": "shade",
4646
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exmeslog",
4747
"source_pid": "22740",
4848
"source_process": "gnome-software-service.desktop"
4949
},
5050
{
51-
"date_stamp": "20170227213046",
51+
"date_stamp": "20180227213046",
5252
"raw_text": "Feb 27 21:30:46 shade gnome-software-service.desktop[22740]: 02:30:46:0275 Gs no app for changed [email protected]",
5353
"log_source": "shade",
5454
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exmeslog",
5555
"source_pid": "22740",
5656
"source_process": "gnome-software-service.desktop"
5757
},
5858
{
59-
"date_stamp": "20170227213046",
59+
"date_stamp": "20180227213046",
6060
"raw_text": "Feb 27 21:30:46 shade gnome-software-service.desktop[22740]: 02:30:46:0276 Gs no app for changed [email protected]",
6161
"log_source": "shade",
6262
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exmeslog",
6363
"source_pid": "22740",
6464
"source_process": "gnome-software-service.desktop"
6565
},
6666
{
67-
"date_stamp": "20170227213046",
67+
"date_stamp": "20180227213046",
6868
"raw_text": "Feb 27 21:30:46 shade gnome-software-service.desktop[22740]: 02:30:46:0277 Gs no app for changed [email protected]",
6969
"log_source": "shade",
7070
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exmeslog",
7171
"source_pid": "22740",
7272
"source_process": "gnome-software-service.desktop"
7373
},
7474
{
75-
"date_stamp": "20170227213046",
75+
"date_stamp": "20180227213046",
7676
"raw_text": "Feb 27 21:30:46 shade gnome-software-service.desktop[22740]: 02:30:46:0304 Gs no app for changed [email protected]",
7777
"log_source": "shade",
7878
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exmeslog",
7979
"source_pid": "22740",
8080
"source_process": "gnome-software-service.desktop"
8181
},
8282
{
83-
"date_stamp": "20170227213046",
83+
"date_stamp": "20180227213046",
8484
"raw_text": "Feb 27 21:30:46 shade gnome-software-service.desktop[22740]: 02:30:46:0277 Gs no app for changed [email protected]",
8585
"log_source": "shade",
8686
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exsyslog",
8787
"source_pid": "22740",
8888
"source_process": "gnome-software-service.desktop"
8989
},
9090
{
91-
"date_stamp": "20170227213046",
91+
"date_stamp": "20180227213046",
9292
"raw_text": "Feb 27 21:30:46 shade gnome-software-service.desktop[22740]: 02:30:46:0304 Gs no app for changed [email protected]",
9393
"log_source": "shade",
9494
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exsyslog",
9595
"source_pid": "22740",
9696
"source_process": "gnome-software-service.desktop"
9797
},
9898
{
99-
"date_stamp": "20170227213046",
99+
"date_stamp": "20180227213046",
100100
"raw_text": "Feb 27 21:30:46 shade dbus[593]: [system] Successfully activated service 'org.freedesktop.hostname1'",
101101
"log_source": "shade",
102102
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exsyslog",
103103
"source_pid": "593",
104104
"source_process": "dbus"
105105
},
106106
{
107-
"date_stamp": "20170227213046",
107+
"date_stamp": "20180227213046",
108108
"raw_text": "Feb 27 21:30:46 shade systemd[1]: Started Hostname Service.",
109109
"log_source": "shade",
110110
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exsyslog",
111111
"source_pid": "1",
112112
"source_process": "systemd"
113113
},
114114
{
115-
"date_stamp": "20170227213052",
115+
"date_stamp": "20180227213052",
116116
"raw_text": "Feb 27 21:30:52 shade dbus-daemon[22491]: Activating via systemd: service name='org.gnome.Terminal' unit='gnome-terminal-server.service'",
117117
"log_source": "shade",
118118
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exsyslog",
119119
"source_pid": "22491",
120120
"source_process": "dbus-daemon"
121121
},
122122
{
123-
"date_stamp": "20170227213052",
123+
"date_stamp": "20180227213052",
124124
"raw_text": "Feb 27 21:30:52 shade systemd[22475]: Starting GNOME Terminal Server...",
125125
"log_source": "shade",
126126
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exsyslog",
127127
"source_pid": "22475",
128128
"source_process": "systemd"
129129
},
130130
{
131-
"date_stamp": "20170227213052",
131+
"date_stamp": "20180227213052",
132132
"raw_text": "Feb 27 21:30:52 shade dbus-daemon[22491]: Successfully activated service 'org.gnome.Terminal'",
133133
"log_source": "shade",
134134
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exsyslog",
135135
"source_pid": "22491",
136136
"source_process": "dbus-daemon"
137137
},
138138
{
139-
"date_stamp": "20170227213052",
139+
"date_stamp": "20180227213052",
140140
"raw_text": "Feb 27 21:30:52 shade systemd[22475]: Started GNOME Terminal Server.",
141141
"log_source": "shade",
142142
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exsyslog",
143143
"source_pid": "22475",
144144
"source_process": "systemd"
145145
},
146146
{
147-
"date_stamp": "20170227213457",
147+
"date_stamp": "20180227213457",
148148
"raw_text": "Feb 27 21:34:57 shade tracker-extract[22716]: unable to create file '/run/user/1000/dconf/user': Permission denied. dconf will not work properly.",
149149
"log_source": "shade",
150150
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exsyslog",
151151
"source_pid": "22716",
152152
"source_process": "tracker-extract"
153153
},
154154
{
155-
"date_stamp": "20170227213501",
155+
"date_stamp": "20180227213501",
156156
"raw_text": "Feb 27 21:35:01 shade CRON[5030]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)",
157157
"log_source": "shade",
158158
"source_path": "/home/dogoncouch/src/logdissect/devtests/files/exsyslog",

tests/tests.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@
2525
# NOTE: This script runs the dev testing suite located in devtest/
2626
# Run it after changes to make sure everything still works.
2727

28+
# Clean up previous tests:
29+
rm tests/files/*.log
30+
# Update year in examples/log mtimes:
31+
touch tests/files/*log
32+
sed -i "s/201./$(date +%Y)/g" tests/files/*log
33+
sed -i "s/201.02/$(date +%Y)02/g" tests/difftests.sh
34+
35+
# Run tests
2836
tests/difftests.sh > tests/files/diffresults.log
2937

38+
# Show diff (nothing if success):
3039
diff tests/files/diffresults.log tests/files/diffexresults

0 commit comments

Comments
 (0)