Skip to content

Commit

Permalink
context changes
Browse files Browse the repository at this point in the history
  • Loading branch information
premalathak12 committed Sep 26, 2023
1 parent e1910be commit e5dca32
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
6 changes: 5 additions & 1 deletion verification/emulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
)

// Added dummy support for emulator .This is to verify against the support_needed list
var emulator_supports = []string{"AutoInit", "X509", "Simulation"}
var emulator_supports = []string{"AutoInit", "X509", "Simulation", "Tagging"}

//TODO code for emulator to start, stop, getsupport

Expand Down Expand Up @@ -164,6 +164,10 @@ func (s *DpeEmulator) GetSupport() *Support {
return &s.supports
}

func (s *DpeEmulator) SetSupport(support Support) {
s.supports = support
}

func (s *DpeEmulator) GetProfile() Profile {
return DPE_EMULATOR_PROFILE
}
Expand Down
4 changes: 2 additions & 2 deletions verification/initializeContext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ func testInitContext(d TestDPEInstance, t *testing.T) {

// Try to get the correct error for overflowing the contexts. Fill up the
// rest of the contexts (-1 for default).
for i := uint32(0); i < getProfileRsp.MaxTciNodes-1; i++ {
for i := uint32(0); i < getProfileRsp.MaxTciNodes-2; i++ {
initCtxResp, err := client.InitializeContext(NewInitCtxIsSimulation())
if err != nil {
t.Fatal("The instance should be able to create a simulation context.")
t.Fatal("The instance should be able to create a simulation context.", err)
}
// Could prove difficult to prove it is a cryptographically secure random.
if initCtxResp.Handle == [16]byte{0} {
Expand Down
4 changes: 4 additions & 0 deletions verification/simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ func (s *DpeSimulator) GetSupport() *Support {
return &s.supports
}

func (s *DpeSimulator) SetSupport(support Support) {
s.supports = support
}

func (s *DpeSimulator) GetProfile() Profile {
return DPE_SIMULATOR_PROFILE
}
Expand Down
7 changes: 5 additions & 2 deletions verification/verification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ var testTargetType string

// This will be called before running tests, and it assigns the socket path based on command line flag.
func TestMain(m *testing.M) {
testTarget := flag.String("target", "emulator", "socket type - simulator")
testTarget := flag.String("target", "simulator", "socket type - emulator")
flag.Parse()
testTargetType = *testTarget
if testTargetType == SIMULATOR {
target_exe = flag.String("sim", "../simulator/target/debug/simulator", "path to simulator executable")
} else if testTargetType == EMULATOR {
target_exe = flag.String("emu", "../server/example", "path to emulator executable")
target_exe = flag.String("emu", "../emulator/target/debug/emulator", "path to emulator executable")
}

exitVal := m.Run()
Expand All @@ -52,6 +52,8 @@ type TestDPEInstance interface {
// it supports, but this function is used by tests to know how to test the DPE
// instance.
GetSupport() *Support
//Set the Support
SetSupport(support Support)
// Returns the profile the transport supports.
GetProfile() Profile
// Returns a slice of all the localities the instance supports.
Expand Down Expand Up @@ -128,6 +130,7 @@ func GetEmulatorTarget(support_needed []string) (TestDPEInstance, error) {
return nil, errors.New("Error in creating dpe instances - supported feature is not enabled in emulator")
}
}
instance.SetSupport(support)
return instance, nil
}

Expand Down

0 comments on commit e5dca32

Please sign in to comment.