Changeset 983

Show
Ignore:
Timestamp:
02/22/07 18:38:32 (4 years ago)
Author:
julians
Message:

Speed up daemon_test; add some inline documentation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/daemon/daemon_test.rb

    r979 r983  
    277277    use_options.update(options) if options 
    278278    @dont_touch_again_files = [] 
     279     
     280    # Determine a random number of mutations to perform in this iteration 
    279281    mutation_count = MIN_MUTATIONS_PER_ITERATION + rand(MAX_MUTATIONS_PER_ITERATION - MIN_MUTATIONS_PER_ITERATION) 
     282 
     283    # Output header for this iteration 
    280284    puts ("-" * 72) 
    281285    @iteration_count += 1 
     
    286290    end 
    287291    puts "Doing #{mutation_count} mutations" 
     292 
     293    # Perform the mutations on the file system 
    288294    1.upto(mutation_count) { mutate_tree(use_options) } 
    289295 
    290296    if not use_options[:replay] 
    291297      puts "Waiting for daemon to update directory" 
    292  
    293       1.upto(4) do 
     298       
     299      # Wait one second so that the changes to the file system become 
     300      # "old enough" to get picked up by the file monitor. 
     301      sleep(1) 
     302 
     303      # We're looping through this twice because if we only pick up 
     304      # the current value of the last_update_finish_time and wait for 
     305      # it to change, we're actually only waiting for the *current* 
     306      # run to finish. But in the current run, the file monitor might 
     307      # have already walked past the changes (because they were not 
     308      # yet old enough.) Looping through this twice means that we wait 
     309      # for a new run to begin and for that run to finish, thereby 
     310      # ensuring that the changes get picked up. 
     311      1.upto(2) do 
    294312        last_time_updated = Earth::Server.this_server.last_update_finish_time 
    295313        begin 
     
    302320        end until last_time_updated != Earth::Server.this_server.last_update_finish_time 
    303321      end 
     322 
    304323      puts "Verifying data integrity" 
    305324      verify_data 
    306325      puts "Integrity verified" 
    307       sleep 2.seconds 
     326 
     327      #sleep 2.seconds 
    308328    end 
    309329  end