[multi-asic] Fixed systemd-sonic-generator for multi-asic#7633
[multi-asic] Fixed systemd-sonic-generator for multi-asic#7633theasianpianist merged 3 commits intosonic-net:masterfrom anamehra:anamehra/master/systemd-sonic-gen
Conversation
1. In function insert_instance_number instance_string was malloced for 2 char
size which was limiting the instance number value in instance_name to 1 digit.
Fixed insert_instance_number to use asprintf to generate instancd_name for
any number of instances. Added _GNU_SOURCE to CFLAGS for asprintf.
2. Fixed get_unit_files() to use calloc instead of malloc. Uninitialized memory
was causing incorrect string mismatch error while comparing unit file name
string.
3. Increased MAX_NUM_TARGETS and MAX_NUM_INSTALL_LINES values to 48 to handle more
asic instances.
4. Added build UT support for systemd-sonic-generator:
a. Refactor systemd-sonic-generator.c to be used with UT infra.
b. Added UT infra to run build UT for systemd-sonic-generator
c. Added functional level and program level UT class and test cases.
Signed-off-by: Anand Mehra <[email protected]>
jleveque
left a comment
There was a problem hiding this comment.
As comments.
And thank you for adding the unit tests!
|
@theasianpianist to check |
1. Explicitly setting global pointers to NULL in definitions.
2. Added a space before ": public" in class definitions to align style
with SONiC C++ files.
Signed-off-by: Anand Mehra <[email protected]>
Signed-off-by: Anand Mehra <[email protected]>
|
Hi @lguohan , The build errors reported after new commit does not look like related. Were these observed earlier? May we rerun the builds? Thanks |
|
/Azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Commenter does not have sufficient privileges for PR 7633 in repo Azure/sonic-buildimage |
|
Hi @theasianpianist - could you please initiate azp run. |
|
/Azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Thanks @theasianpianist for re-executing pipeline. |
|
@theasianpianist - thanks, could you please review and approve, kindly help with merge. |
|
revert this pr, please fix the armhf build. |
)" This reverts commit 4f8dec9.
|
Hi @lguohan , @theasianpianist , the build issue with armfh was because the static gtest lib was not being pacakged. I have fixed it by using -lgtest which works for both arm64 and armfh builds. I was wondering if I should split this PR in two PRs, one for actual systemd-sonic-generator changes to required multi-asic enhancements and the other for UT code enhancement only. Please advise. |
|
@theasianpianist Created #7954 with only change in Makefile for -lgtest |
…7633) * Fixed systemd-sonic-generator for multi-asic 1. In function insert_instance_number instance_string was malloced for 2 char size which was limiting the instance number value in instance_name to 1 digit. Fixed insert_instance_number to use asprintf to generate instancd_name for any number of instances. Added _GNU_SOURCE to CFLAGS for asprintf. 2. Fixed get_unit_files() to use calloc instead of malloc. Uninitialized memory was causing incorrect string mismatch error while comparing unit file name string. 3. Increased MAX_NUM_TARGETS and MAX_NUM_INSTALL_LINES values to 48 to handle more asic instances. 4. Added build UT support for systemd-sonic-generator: a. Refactor systemd-sonic-generator.c to be used with UT infra. b. Added UT infra to run build UT for systemd-sonic-generator c. Added functional level and program level UT class and test cases. * Resolved review comments. 1. Explicitly setting global pointers to NULL in definitions. 2. Added a space before ": public" in class definitions to align style with SONiC C++ files. * Merged strtok_r statements in single command. Signed-off-by: Anand Mehra <[email protected]>
…nic-net#7633)" This reverts commit 4f8dec9.
Signed-off-by: Anand Mehra [email protected]
Why I did it
How I did it
How to verify it
On a single asic system:
/run/systemd/generator/multi-user.target.wants/
/run/systemd/generator/sonic.target.wants/
/run/systemd/generator/swss.service.wants/
On a multi asic system:
/run/systemd/generator/multi-user.target.wants/
/run/systemd/generator/sonic.target.wants/
/run/systemd/generator/[email protected]/ where n is instance num 0 - (num_asic-1)
Build UT logs:
systemd-sonic-generator_1.0.0_amd64.deb.log
Single asic system logs:
Single_asic.logs.txt
Multi asic system logs:
multi-asic.logs.txt
Which release branch to backport (provide reason below if selected)
Description for the changelog
A picture of a cute animal (not mandatory but encouraged)