Method: Mu::Command::Cmd_runscale#cmd_run_files

Defined in:
lib/mu/command/cmd_runscale.rb

#cmd_run_files(argv) ⇒ Object

sets up, executes, and closes a Studio Scale test for one scenario or each scenario (.msl file) found in the specified directory

* argv = command-line arguments
* optional -s scenario file
* optional -d directory containing one or more scenario files
* optional -r argument for recursive directory search (default is a flat directory)


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/mu/command/cmd_runscale.rb', line 23

def cmd_run_files argv
    setup argv

    msg "Clean up existing stats files: app_id_status.json, app_id_stats.csv", Logger::INFO
    File.delete("app_id_status.json") if File.exists?("app_id_status.json")
    File.delete("app_id_stats.csv") if File.exists?("app_id_stats.csv")

    @api = Scale.new(@@mu_ip, @@mu_admin_user, @@mu_admin_pass)
    @api.configure("pattern", @cmd_line_pattern)
    @params = {}
    @params["hosts"] = @cmd_line_hosts
    if @hash["dir"].nil?
        files = [@hash["scenario"]]
    else
        recursive = (@hash['recursive'].nil?) ? "": "**"
        files = Dir.glob(File.join(@hash["dir"],recursive,"*.msl"))
    end
    if files.nil? or files.empty?
        msg "no msl files found", Logger::ERROR
    else
        files.each do | scenario |
            begin
                run scenario
            rescue Exception => e
                msg "Run failed: #{e}/nBACKTRACE:#{e.backtrace}", Logger::ERROR
            end
            if @verify_only
                output_verify_results scenario
            else
                output_csv scenario
            end
            sleep 2
        end
    end
    @api.release
end