Ticket #88: bug_88_UIPainter_canvas_with_grid_on_shows_artefacts_when_restarted_from_a_snapshot.rb

File bug_88_UIPainter_canvas_with_grid_on_shows_artefacts_when_restarted_from_a_snapshot.rb, 2.0 KB (added by jan vrany, 8 years ago)
Line 
1#!/usr/bin/ruby
2
3require 'fileutils'
4require 'rbconfig'
5include FileUtils
6
7rc_d = 'rc.d'
8if not File.exist? rc_d then
9 rc_d = "../lib/smalltalkx/6.2.5/lib/rc.d"
10end
11
12token="bug_86_starting_stx_with_saved_image_kills_the_whole_environment"
13
14
15stx_cmd = nil
16if File.exist? 'stx.com' then
17 stx_cmd = 'stx.com'
18elsif File.exist? 'stx-bin.com' then
19 stx_cmd = 'stx-bin.com'
20else
21 stx_cmd = './stx'
22end
23puts "stx_cmd = #{stx_cmd.inspect}"
24
25File.open("#{rc_d}/99-#{token}.rc", "w") do | f |
26 f.write <<END
27(OperatingSystem getEnvironment: '#{token}') = '1' ifTrue:[
28 Smalltalk addStartBlock:[
29 | p |
30 [
31 "FRESH start"
32 Smalltalk addImageStartBlock:[
33 "RESTARTING from a snapshot"
34 [
35 | ok |
36
37 Stdout nextPutLine: 'Restarted from snapshot.'.
38 ok := Dialog confirm: 'Does the grid shown in UIPainter''s canvas look OK?'.
39 (OperatingSystem getEnvironment: '#{token}') = '1' ifTrue:[
40 Smalltalk exit: 121 + (ok ifTrue:[0] ifFalse:[10]).
41 ].
42 ] fork.
43 ].
44 p := UIPainter new.
45 p open.
46 p gridShownHolder value: true.
47 p alignToGridHolder value: true.
48 p := nil.
49 Delay waitForSeconds: 1.
50 Smalltalk garbageCollect.
51 ObjectMemory snapShot.
52 Smalltalk exit: 123.
53 ] fork.
54 ].
55]
56END
57end
58
59ENV[token] = '1'
60
61# Step 1.
62rm_f 'st.img'; rm_f 'st.sav'; rm_f 'st.chg'
63
64# Step 2.
65system "#{stx_cmd} -I --quick"
66if $?.exitstatus != 123 then
67 raise Exception.new("stx failed to execute (status #{$?.exitstatus})");
68end
69
70if not File.exist? 'st.img' then
71 raise Exception.new("st.img was not saved")
72end
73
74# Step 3.
75system "#{stx_cmd} -i st.img"
76if $?.exitstatus != 121 then
77 puts
78 puts "Start gdb as:"
79 puts
80 puts ' C:\mingw64\bin\gdb.exe --args stx-bin.com -i st.img'
81 puts
82 raise Exception.new("stx failed to restart from a snapshot (status #{$?.exitstatus})");
83end
84
85puts
86puts "PASSED"