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

[cirque] Initial support for Cirque test #2042

Merged
merged 6 commits into from
Aug 19, 2020

Conversation

erjiaqing
Copy link
Contributor

@erjiaqing erjiaqing commented Aug 10, 2020

Summary of Changes

  • Adds a zcl server for posix mock devices.
  • Adds the dockerfile for integration into cirque.
  • Adds cirque based on-off cluster test.
  • Implements CHIPTestBase as a helper class.

How to test

  • Install and start a cirque flask server
  • Run do_on-off-cluster-test.sh

Note:

  • Cirque does not support running docker images with params, and does not support running a command in background, so we build two docker images, this should be fixed once cirque implements either running a command in background or running image with params.

fixes #1891

@restyled-io restyled-io bot mentioned this pull request Aug 10, 2020
@erjiaqing erjiaqing changed the title Issue1891 cirque [cirque] Initial support for Cirque test Aug 10, 2020

constexpr chip::NodeId kLocalNodeId = 12344321;

#define println(format, ...) printf(format "\n", ##__VA_ARGS__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we just use printf and avoid the extra indirection?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you re-upload the branch to update? I don't seem to see updated changes.

class ServerCallback : public SecureSessionMgrCallback
{
public:
virtual void OnMessageReceived(const MessageHeader & header, Transport::PeerConnectionState * state,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest using 'override' instead of virtual to make it clear we override a base method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

}
};

static ServerCallback gCallbacks;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static not needed in anonymous namespace

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

fp.write(ret_log.log)


def create_device_from_config():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we use DEVICE_CONFIG.values() insead?

I can only see the config used as a list - should it be a list instead of a dict?


device_ids = set()

for device in self.device_config:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use for device in self.device_config.values() and use **device instead of **self.device_config[device]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer applied since we switched to flask api

except:
traceback.print_exc(file=sys.stdout)
test_success = False
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass here and below do not seem needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by moving test warpper to base class

continue
self.logger.info("return ip: {}".format(ipstr))
return str(ipaddr)
except:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what exceptions can happen here?

Could you add a comment about them and why it is appropriate to silently ignore them? I am used to at least logging exceptions.

Copy link
Contributor Author

@erjiaqing erjiaqing Aug 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment to explain why just ignore the exception

return emberAfSendInterPan(panId, destinationLongId, destinationShortId, multicastId, emAfCommandApsFrame->clusterId, profileId,
*emAfResponseLengthPtr, emAfZclBuffer);
}
// EmberStatus emberAfSendCommandUnicastToBindingsWithCallback(EmberAfMessageSentFunction callback)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These functions will not be called and will block chip-server from linking, so comment them out.


return true;
}
// bool emberAfEndpointEnableDisable(uint8_t endpoint, bool enable)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These functions will not be called and will block chip-server from linking, so comment them out.

emberAfGetEui64(myEui64);
return (0 == memcmp(eui64, myEui64, EUI64_SIZE) ? true : false);
}
// EmberStatus emberAfEndpointEventControlSetDelayMS(EmberEventControl * controls, uint8_t endpoint, uint32_t delayMs)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These functions will not be called and will block chip-server from linking, so comment them out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do they block chip-server from linking?

@erjiaqing
Copy link
Contributor Author

I guess #1761 can be implemented first so we can have a valid chip server implementation.

@@ -0,0 +1,87 @@
/**
Copy link
Contributor

@gjc13 gjc13 Aug 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these files under examples/chip-tool/gen? I personally believe they should be in the core library.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to current status, seems we will still put them in seperate example directories.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this particular file is generated specifically for the app, is different for every collection of clusters

@erjiaqing erjiaqing force-pushed the issue1891-cirque branch 2 times, most recently from 863ee7c to c4bef25 Compare August 13, 2020 13:30
gjc13 and others added 3 commits August 18, 2020 10:12
- Adds a zcl server for posix mock devices.
- Adds the dockerfile for integration into cirque.
@github-actions
Copy link

Size increase report for "nrf-example-build"

File Section File VM
chip-nrf52840-lock-example.out .text 16 16
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-nrf52840-lock-example.out and ./pull_artifact/chip-nrf52840-lock-example.out:

sections,vmsize,filesize
.text,16,16
[Unmapped],0,-14
.strtab,0,-19
.debug_abbrev,0,-24
.symtab,0,-32
.debug_aranges,0,-160
.debug_ranges,0,-264
.debug_frame,0,-484
.debug_line,0,-968
.debug_str,0,-1206
.debug_loc,0,-2244
.debug_info,0,-2345


@github-actions
Copy link

Size increase report for "nrfconnect-example-build"

File Section File VM
chip-nrf52840-lock-example.elf [LOAD #1 [RWX]] 8 8
chip-nrf52840-lock-example.elf text 8 8
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-nrf52840-lock-example.elf and ./pull_artifact/chip-nrf52840-lock-example.elf:

sections,vmsize,filesize
[LOAD #1 [RWX]],8,8
text,8,8
[Unmapped],0,-17
.strtab,0,-19
.debug_abbrev,0,-24
.symtab,0,-32
.debug_aranges,0,-160
.debug_ranges,0,-264
.debug_frame,0,-484
.debug_line,0,-1041
.debug_str,0,-1206
.debug_loc,0,-2244
.debug_info,0,-2345


@github-actions
Copy link

Size increase report for "linux-example-build"

File Section File VM
chip-standalone-demo.out .text 80 80
chip-standalone-demo.out .dynstr 52 52
chip-standalone-demo.out .rodata 32 32
chip-standalone-demo.out .dynsym 24 24
chip-standalone-demo.out .rela.plt 24 24
chip-standalone-demo.out .eh_frame 16 16
chip-standalone-demo.out .gnu.version_r 16 16
chip-standalone-demo.out .plt 16 16
chip-standalone-demo.out .plt.sec 16 16
chip-standalone-demo.out .got 8 8
chip-standalone-demo.out [3 Others] -4 -4
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-standalone-demo.out and ./pull_artifact/chip-standalone-demo.out:

sections,vmsize,filesize
.debug_str,0,7311
.debug_info,0,6399
.debug_abbrev,0,373
.debug_line,0,313
.debug_loc,0,254
.debug_ranges,0,128
.text,80,80
.strtab,0,53
.dynstr,52,52
.debug_macro,0,49
.rodata,32,32
.dynsym,24,24
.rela.plt,24,24
.symtab,0,24
.eh_frame,16,16
.gnu.version_r,16,16
.plt,16,16
.plt.sec,16,16
.got,8,8
[3 Others],-4,-4
[Unmapped],0,-288


@github-actions
Copy link

Size increase report for "esp32-example-build"

File Section File VM
chip-wifi-echo.elf .flash.text -12 -12
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-wifi-echo.elf and ./pull_artifact/chip-wifi-echo.elf:

sections,vmsize,filesize
[Unmapped],0,-4
.flash.text,-12,-12
.symtab,0,-16
.strtab,0,-19
.debug_abbrev,0,-24
.debug_aranges,0,-160
.debug_ranges,0,-232
.debug_frame,0,-480
.debug_loc,0,-825
.debug_str,0,-1206
.debug_line,0,-1952
.debug_info,0,-2346


@github-actions
Copy link

Size increase report for "gn_nrf-example-build"

File Section File VM
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv


@github-actions
Copy link

Size increase report for "gn_linux-example-build"

File Section File VM
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv


@woody-apple
Copy link
Contributor

@erjiaqing Can we try to get this integrated into GitHub workflows?

@erjiaqing
Copy link
Contributor Author

@erjiaqing Can we try to get this integrated into GitHub workflows?

I will submit another PR to integrate this into Github workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Land Cirque X Chip Demo code and bring up presubmit integration in CHIP
7 participants