Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add example config, a testcase to use in the debugger and decoder cod… #271

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions ios/nskeyedarchiver/archiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/danielpaulus/go-ios/ios/nskeyedarchiver"
archiver "github.com/danielpaulus/go-ios/ios/nskeyedarchiver"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)
Expand All @@ -35,20 +34,8 @@ func TestArchiveSlice(t *testing.T) {

// TODO currently only partially decoding XCTestConfig is supported, fix later
func TestXCTestconfig(t *testing.T) {
uuid := uuid.New()
config := nskeyedarchiver.NewXCTestConfiguration("productmodulename", uuid, "targetAppBundle", "targetAppPath", "testBundleUrl")
result, err := nskeyedarchiver.ArchiveXML(config)
if err != nil {
log.Error(err)
t.Fatal()
}
print(result)
log.Info(uuid.String())
res, err := nskeyedarchiver.Unarchive([]byte(result))
assert.NoError(t, err)
log.Info(res)

nskeyedBytes, err := ioutil.ReadFile("fixtures/xctestconfiguration.bin")
nskeyedBytes, err := ioutil.ReadFile("fixtures/xctestconfig-with-test-to-run.plist")
if err != nil {
log.Error(err)
t.Fatal()
Expand Down
Binary file not shown.
21 changes: 21 additions & 0 deletions ios/nskeyedarchiver/objectivec_classes.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func SetupDecoders() {
"DTTapStatusMessage": NewDTTapStatusMessage,
"DTTapMessage": NewDTTapMessage,
"DTCPUClusterInfo": NewDTCPUClusterInfo,
"XCTTestIdentifierSet": NewXCTTestIdentifierSet,
}
}
}
Expand Down Expand Up @@ -293,6 +294,13 @@ func (x XCTTestIdentifier) String() string {
return fmt.Sprintf("XCTTestIdentifier{o:%d , c:%v}", x.O, x.C)
}

func NewXCTTestIdentifierSet(object map[string]interface{}, objects []interface{}) interface{} {
identifiers := object["identifiers"]
obj, err := extractObjects([]plist.UID{identifiers.(plist.UID)}, objects)
print(err)
return obj
}

func NewXCTTestIdentifier(object map[string]interface{}, objects []interface{}) interface{} {
ref := object["c"].(plist.UID)
// plist, _ := extractObjects(objects[ref].(map[string]interface{}), objects)
Expand All @@ -317,6 +325,19 @@ type PartiallyExtractedXcTestConfig struct {
func NewXCTestConfigurationFromBytes(object map[string]interface{}, objects []interface{}) interface{} {
config := make(map[string]interface{}, len(object))
for k, v := range object {
if k == "testIdentifiersToRun" {
value := v
uid, ok := v.(plist.UID)
if ok {
value = objects[uid]
}
array, err := extractObjects([]plist.UID{uid}, objects)
print(array)
print(err)
xc := NewXCTTestIdentifier(value.(map[string]interface{}), objects)
print(xc)
}

value := v
uid, ok := v.(plist.UID)
if ok {
Expand Down