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

examples/sotest: remove unnecessary config and fix minor issue #1866

Merged
merged 2 commits into from
Jul 31, 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
8 changes: 0 additions & 8 deletions examples/sotest/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ config EXAMPLES_SOTEST_DEVMINOR
Used for registering the RAM block driver that will hold the ROMFS file system
containing the SOTEST executables to be tested. Default: 0

config EXAMPLES_SOTEST_DEVPATH
string "ROMFS Device Path"
default "/dev/ram0"
---help---
The path to the ROMFS block driver device. This must match EXAMPLES_SOTEST_DEVMINOR.
Used for registering the RAM block driver that will hold the ROMFS file system
containing the SOTEST executables to be tested. Default: "/dev/ram0"

endif # EXAMPLES_SOTEST_BUILTINFS

if !EXAMPLES_SOTEST_BUILTINFS
Expand Down
17 changes: 10 additions & 7 deletions examples/sotest/sotest_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <dlfcn.h>
#include <errno.h>
#include <debug.h>
#include <unistd.h>

#include <nuttx/symtab.h>

Expand Down Expand Up @@ -73,14 +74,12 @@
# ifndef CONFIG_EXAMPLES_SOTEST_DEVMINOR
# define CONFIG_EXAMPLES_SOTEST_DEVMINOR 0
# endif

# ifndef CONFIG_EXAMPLES_SOTEST_DEVPATH
# define CONFIG_EXAMPLES_SOTEST_DEVPATH "/dev/ram0"
# endif
#else
# define BINDIR CONFIG_EXAMPLES_SOTEST_BINDIR
#endif /* CONFIG_EXAMPLES_SOTEST_BUILTINFS */

#define SOTEST_DEVPATH_FMT "/dev/ram%d"

/****************************************************************************
* Symbols from Auto-Generated Code
****************************************************************************/
Expand All @@ -103,6 +102,7 @@ extern const int g_sot_nexports;

int main(int argc, FAR char *argv[])
{
char devname[32];
#if CONFIG_MODLIB_MAXDEPEND > 0
FAR void *handle1;
#endif
Expand Down Expand Up @@ -144,15 +144,16 @@ int main(int argc, FAR char *argv[])

/* Mount the file system */

sprintf(devname, SOTEST_DEVPATH_FMT, CONFIG_EXAMPLES_SOTEST_DEVMINOR);
printf("main: Mounting ROMFS filesystem at target=%s with source=%s\n",
BINDIR, CONFIG_EXAMPLES_SOTEST_DEVPATH);
BINDIR, devname);

ret = mount(CONFIG_EXAMPLES_SOTEST_DEVPATH, BINDIR, "romfs", MS_RDONLY,
ret = mount(devname, BINDIR, "romfs", MS_RDONLY,
NULL);
if (ret < 0)
{
fprintf(stderr, "ERROR: mount(%s,%s,romfs) failed: %s\n",
CONFIG_EXAMPLES_SOTEST_DEVPATH, BINDIR, strerror(errno));
devname, BINDIR, strerror(errno));
exit(EXIT_FAILURE);
}
#endif /* CONFIG_EXAMPLES_SOTEST_BUILTINFS */
Expand Down Expand Up @@ -282,6 +283,8 @@ int main(int argc, FAR char *argv[])
BINDIR, errno);
exit(EXIT_FAILURE);
}

unlink(devname);
#endif /* CONFIG_EXAMPLES_SOTEST_BUILTINFS */

return EXIT_SUCCESS;
Expand Down
Loading