Sha256: de16bfcfe1ceea904c8e74e37cafdcc40564bf8a6b2a86daea8cfc3226f7a79d

Contents?: true

Size: 1.57 KB

Versions: 11

Compression:

Stored size: 1.57 KB

Contents

require 'active_support/concern'
module OrigenTesters
  # Include this module to create an interface that supports multiple tester
  # types.
  #
  # This module will expose generators for all test platforms supported by
  # the Testers plugin.
  module ProgramGenerators
    extend ActiveSupport::Concern

    PLATFORMS = [J750, J750_HPT, UltraFLEX, V93K]

    included do
      Origen.add_interface(self)
    end

    module ClassMethods
      # Ensures that the correct generator is loaded before initialize is called
      def new(*args, &block)
        x = allocate
        x._load_generator
        x.send(:initialize, *args, &block)
        x
      end

      # Returns true if the interface class supports the
      # given tester instance
      def supports?(tester_instance)
        PLATFORMS.include?(tester_instance.class)
      end
    end

    def initialize(options = {})
    end

    def tester
      Origen.tester
    end

    def _load_generator
      if tester.v93k?
        class << self; include OrigenTesters::V93K::Generator; end
      elsif tester.j750_hpt?
        class << self; include OrigenTesters::J750_HPT::Generator; end
      elsif tester.j750?
        class << self; include OrigenTesters::J750::Generator; end
      elsif tester.ultraflex?
        class << self; include OrigenTesters::UltraFLEX::Generator; end
      elsif defined? tester.class::TEST_PROGRAM_GENERATOR
        class << self; include tester.class::TEST_PROGRAM_GENERATOR; end
      else
        fail "The OrigenTesters::ProgramGenerators module does not support #{tester.class}!"
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
origen_testers-0.7.12 lib/origen_testers/program_generators.rb
origen_testers-0.7.11 lib/origen_testers/program_generators.rb
origen_testers-0.7.10 lib/origen_testers/program_generators.rb
origen_testers-0.7.9 lib/origen_testers/program_generators.rb
origen_testers-0.7.8 lib/origen_testers/program_generators.rb
origen_testers-0.7.7 lib/origen_testers/program_generators.rb
origen_testers-0.7.6 lib/origen_testers/program_generators.rb
origen_testers-0.7.5 lib/origen_testers/program_generators.rb
origen_testers-0.7.4 lib/origen_testers/program_generators.rb
origen_testers-0.7.3 lib/origen_testers/program_generators.rb
origen_testers-0.7.2 lib/origen_testers/program_generators.rb