1 | #!/usr/bin/ruby |
---|
2 | |
---|
3 | require 'fileutils' |
---|
4 | include FileUtils |
---|
5 | |
---|
6 | File.open("../lib/smalltalkx/6.2.5/lib/rc.d/99-bug_81_Saving_snapshot_breakes_the_image.rc", "w") do | f | |
---|
7 | f.write <<END |
---|
8 | (OperatingSystem getEnvironment: 'bug_81_Saving_snapshot_breakes_the_image') = '1' ifTrue:[ |
---|
9 | Smalltalk addStartBlock:[ |
---|
10 | Smalltalk imageRestartTime isNil ifTrue:[ |
---|
11 | "FRESH start" |
---|
12 | (Smalltalk at: #'Tools::NewSystemBrowser') openAt: 1@1. |
---|
13 | Stdout nextPutLine: 'Will save a snapshot and exit in 3 seconds.'. |
---|
14 | Delay waitForSeconds: 3. |
---|
15 | ObjectMemory snapShot. |
---|
16 | Smalltalk exit: 123. |
---|
17 | ] ifFalse:[ |
---|
18 | "RESTARTING from a snapshot" |
---|
19 | (Smalltalk at: #'WorkspaceApplication') openAt: 1@1. |
---|
20 | Stdout nextPutLine: 'Restarted from snapshot.'. |
---|
21 | Stdout nextPutLine: 'Will exit in 3 seconds.'. |
---|
22 | Delay waitForSeconds: 3. |
---|
23 | Smalltalk exit: 121. |
---|
24 | ] |
---|
25 | ] |
---|
26 | ] |
---|
27 | END |
---|
28 | end |
---|
29 | |
---|
30 | ENV['bug_81_Saving_snapshot_breakes_the_image'] = '1' |
---|
31 | |
---|
32 | # Step 1. |
---|
33 | rm_f 'st.img'; rm_f 'st.sav'; rm_f 'st.chg' |
---|
34 | |
---|
35 | # Step 2. |
---|
36 | system 'stx.bat -I' |
---|
37 | if $?.exitstatus != 123 then |
---|
38 | raise Exception.new("stx failed to execute (status #{$?.exitstatus})"); |
---|
39 | end |
---|
40 | |
---|
41 | if not File.exist? 'st.img' then |
---|
42 | raise Exception.new("st.img was not saved") |
---|
43 | end |
---|
44 | |
---|
45 | # Step 3. |
---|
46 | system 'stx.bat -i st.img' |
---|
47 | if $?.exitstatus != 121 then |
---|
48 | puts |
---|
49 | puts "Start gdb as:" |
---|
50 | puts |
---|
51 | puts ' C:\mingw64\bin\gdb.exe --args stx-bin.com -i st.img' |
---|
52 | puts |
---|
53 | raise Exception.new("stx failed to restart from a snapshot (status #{$?.exitstatus})"); |
---|
54 | end |
---|
55 | |
---|
56 | puts |
---|
57 | puts "PASSED" |
---|