Skip to content

Commit

Permalink
[multi-asic] Fixed systemd-sonic-generator for multi-asic (#7954)
Browse files Browse the repository at this point in the history
Why I did it

systemd-sonic-generator limits multi-asic unit file instances to 10 (single digit instance number 0 - 10). This limitation needs to be removed to handle more than 10 asics.
MAX_NUM_TARGETS and MAX_NUM_INSTALL_LINES limits to 15 which is not sufficient for systems with more than 15 asics.
Inside get_unit_files(), strcmp produce incorrect results due to non null terminated string being compared.

 Added build UT support for systemd-sonic-generator
  • Loading branch information
anamehra authored Jul 8, 2021
1 parent 82b3a39 commit 3b30127
Show file tree
Hide file tree
Showing 13 changed files with 760 additions and 59 deletions.
1 change: 1 addition & 0 deletions src/systemd-sonic-generator/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
systemd-sonic-generator
ssg_test
debian/*
!debian/changelog
!debian/compat
Expand Down
21 changes: 20 additions & 1 deletion src/systemd-sonic-generator/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
CC=gcc
CFLAGS=-std=gnu99
CFLAGS=-std=gnu99 -D_GNU_SOURCE

CPP=g++
CPPFLAGS=-std=c++11 -D_GNU_SOURCE
LFLAGS=-lpthread -lboost_filesystem -lboost_system -lgtest

BINARY = systemd-sonic-generator
MAIN_TARGET = $(BINARY)_1.0.0_$(CONFIGURED_ARCH).deb
Expand All @@ -20,3 +24,18 @@ install: $(BINARY)
mkdir -p $(DESTDIR)/lib/systemd
mkdir -p $(DESTDIR)/lib/systemd/system-generators
cp ./systemd-sonic-generator $(DESTDIR)/lib/systemd/system-generators

.PHONY: test
test: ssg_test
./ssg_test

ssg_test: ssg-test.cc systemd-sonic-generator.o
$(CPP) $(CPPFLAGS) -o $@ $^ $(LFLAGS)

systemd-sonic-generator.o: systemd-sonic-generator.c
$(CC) $(CFLAGS) -D_SSG_UNITTEST -o $@ -c $^

clean:
rm -f ./systemd-sonic-generator
rm -f ./systemd-sonic-generator.o
rm -f ./ssg_test
1 change: 0 additions & 1 deletion src/systemd-sonic-generator/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ PACKAGEVERSION = $(VERSION)
dh $@

override_dh_auto_clean:
override_dh_auto_test:
override_dh_auto_build:
override_dh_auto_install:
make systemd-sonic-generator
Expand Down
Loading

0 comments on commit 3b30127

Please # to comment.