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

tests/pkg_nanors: use static allocation #19382

Merged
merged 2 commits into from
Mar 15, 2023
Merged
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
2 changes: 1 addition & 1 deletion pkg/nanors/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PKG_NAME=nanors
PKG_URL=https://github.com/sleepybishop/nanors.git
PKG_VERSION=395e5ada44dd8d5974eaf6bb6b17f23406e3ca72
PKG_VERSION=e9e242e98e27037830490b2a752895ca68f75f8b
PKG_LICENSE=MIT

include $(RIOTBASE)/pkg/pkg.mk
Expand Down
12 changes: 7 additions & 5 deletions tests/pkg_nanors/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ int main(void)
static uint8_t data[(DATA_SHARDS + RECOVERY_SHARDS) * SHARD_SIZE];
/* copy of data for comparison */
static uint8_t data_cmp[DATA_SHARDS * SHARD_SIZE];
/* nanors work buffer */
static uint8_t rs_buf[reed_solomon_bufsize(DATA_SHARDS, RECOVERY_SHARDS)];

/* pointer to shards */
static uint8_t *shards[DATA_SHARDS + RECOVERY_SHARDS];
uint8_t *shards[DATA_SHARDS + RECOVERY_SHARDS];
/* map of missing shards */
static uint8_t marks[DATA_SHARDS + RECOVERY_SHARDS];
uint8_t marks[DATA_SHARDS + RECOVERY_SHARDS];
memset(marks, 0, sizeof(marks));

/* generate random data */
random_bytes(data, sizeof(data_cmp));
Expand All @@ -51,8 +55,7 @@ int main(void)
}

puts("START");
reed_solomon_init();
rs_t *rs = reed_solomon_new(DATA_SHARDS, RECOVERY_SHARDS);
rs_t *rs = reed_solomon_new_static(rs_buf, sizeof(rs_buf), DATA_SHARDS, RECOVERY_SHARDS);
if (!rs) {
puts("failed to init codec");
return -1;
Expand All @@ -79,7 +82,6 @@ int main(void)
} else {
puts("done.");
}
reed_solomon_release(rs);

if (memcmp(data, data_cmp, sizeof(data_cmp))) {
puts("FAILED");
Expand Down