Faculty of Information Technology
Software Engineering Group

Ticket #81: bug_81_Saving_snapshot_breakes_the_image.rb

File bug_81_Saving_snapshot_breakes_the_image.rb, 1.5 KB (added by Jan Vrany, 7 years ago)

Simple script to reproduce a buggy image

Line 
1#!/usr/bin/ruby
2
3require 'fileutils'
4include FileUtils
5
6File.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]
27END
28end     
29
30ENV['bug_81_Saving_snapshot_breakes_the_image'] = '1'
31
32# Step 1.
33rm_f 'st.img'; rm_f 'st.sav'; rm_f 'st.chg'
34
35# Step 2.
36system 'stx.bat -I'
37if $?.exitstatus != 123 then
38  raise Exception.new("stx failed to execute (status #{$?.exitstatus})");
39end
40
41if not File.exist? 'st.img' then
42  raise Exception.new("st.img was not saved")
43end
44
45# Step 3.
46system 'stx.bat -i st.img'
47if $?.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})");
54end
55
56puts 
57puts "PASSED"