Sha256: 97a022be7609daaf6c5307b5717465a8d4d0fe2c399cb1e8f9c50ebb3cf7b49c

Contents?: true

Size: 1.49 KB

Versions: 10

Compression:

Stored size: 1.49 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)
      include Generator::FlowControlAPI::Interface
    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
      else
        fail "The Testers::ProgramGenerators module does not support #{tester.class}!"
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
origen_testers-0.5.7 lib/origen_testers/program_generators.rb
origen_testers-0.5.6 lib/origen_testers/program_generators.rb
origen_testers-0.5.5 lib/origen_testers/program_generators.rb
origen_testers-0.5.4 lib/origen_testers/program_generators.rb
origen_testers-0.5.3 lib/origen_testers/program_generators.rb
origen_testers-0.5.2 lib/origen_testers/program_generators.rb
origen_testers-0.5.1 lib/origen_testers/program_generators.rb
origen_testers-0.5.0 lib/origen_testers/program_generators.rb
origen_testers-0.4.1 lib/origen_testers/program_generators.rb
origen_testers-0.4.0 lib/origen_testers/program_generators.rb