|
|
|
@@ -311,6 +311,7 @@ STATIC int8_t createStubExpected(char *aNoSuffix, FILE *aFile, FILE *aHeader, cf
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
STATIC int8_t createStubGlobals(char *aNoSuffix, FILE *aFile, FILE *aHeader, cfile_variableList_t *aList)
|
|
|
|
STATIC int8_t createStubGlobals(char *aNoSuffix, FILE *aFile, FILE *aHeader, cfile_variableList_t *aList)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cfile_variable_t *work = NULL;
|
|
|
|
cfile_variable_t *work = NULL;
|
|
|
|
@@ -332,6 +333,16 @@ STATIC int8_t createStubGlobals(char *aNoSuffix, FILE *aFile, FILE *aHeader, cfi
|
|
|
|
fprintf(aFile, "%s (%s)%s;"NEWLINES, work->dataType, work->name, (work->array ? work->array : ""));
|
|
|
|
fprintf(aFile, "%s (%s)%s;"NEWLINES, work->dataType, work->name, (work->array ? work->array : ""));
|
|
|
|
fprintf(aHeader, "extern %s (%s)%s;"NEWLINES, work->dataType, work->name, (work->array ? work->array : ""));
|
|
|
|
fprintf(aHeader, "extern %s (%s)%s;"NEWLINES, work->dataType, work->name, (work->array ? work->array : ""));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (CVARIABLE_CHECK_TYPE(work->type, CVARIABLE_TYPE_CONST))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fprintf(aFile, "%s %s%s = "STUBVARIABLE_INIT_S1";"NEWLINES, work->dataType, work->name, (work->array ? work->array : ""), work->name);
|
|
|
|
|
|
|
|
fprintf(aHeader, "extern %s %s%s;"NEWLINES, work->dataType, work->name, (work->array ? work->array : ""));
|
|
|
|
|
|
|
|
fprintf(aHeader, "#ifndef "STUBVARIABLE_INIT_S1""NEWLINES, work->name);
|
|
|
|
|
|
|
|
// using zero-initialization rule {0} with any amount of dimensions for arrays
|
|
|
|
|
|
|
|
fprintf(aHeader, "\t#define "STUBVARIABLE_INIT_S1" %s"NEWLINES, work->name,
|
|
|
|
|
|
|
|
(work->array ? "{0}" : "("STUBDEFAULT_VALUE_VARIABLE_S")"));
|
|
|
|
|
|
|
|
fprintf(aHeader, "#endif"NEWLINES NEWLINES);
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fprintf(aFile, "%s %s%s;"NEWLINES, work->dataType, work->name, (work->array ? work->array : ""));
|
|
|
|
fprintf(aFile, "%s %s%s;"NEWLINES, work->dataType, work->name, (work->array ? work->array : ""));
|
|
|
|
@@ -885,8 +896,8 @@ STATIC void createUserFiles(char *aOutput, char *aNoSuffix, bool aVaList)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
fprintf(fileDesc, "/*! @file %s"NEWLINES, gnu_basename(cHeaderName));
|
|
|
|
fprintf(fileDesc, "/*! @file %s"NEWLINES, gnu_basename(cHeaderName));
|
|
|
|
fprintf(fileDesc, " * @details"NEWLINES" * This is a user defined stub header.\\n"NEWLINES);
|
|
|
|
fprintf(fileDesc, " * @details"NEWLINES" * This is a user defined stub header."NEWLINES);
|
|
|
|
fprintf(fileDesc, " * Define subject header needed for compilation of stub (e.g. typedefs, structures, ...).\\n"NEWLINES);
|
|
|
|
fprintf(fileDesc, " * Define subject header needed for compilation of stub (e.g. typedefs, structures, ...)."NEWLINES);
|
|
|
|
fprintf(fileDesc, " * - generated by stubser %s -"NEWLINES" */" NEWLINES NEWLINES, GITVERSION);
|
|
|
|
fprintf(fileDesc, " * - generated by stubser %s -"NEWLINES" */" NEWLINES NEWLINES, GITVERSION);
|
|
|
|
|
|
|
|
|
|
|
|
fprintf(fileDesc, "#ifndef _STUB_%s_USER_H"NEWLINES, aNoSuffix);
|
|
|
|
fprintf(fileDesc, "#ifndef _STUB_%s_USER_H"NEWLINES, aNoSuffix);
|
|
|
|
@@ -919,8 +930,8 @@ STATIC void createUserFiles(char *aOutput, char *aNoSuffix, bool aVaList)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
fprintf(fileDesc, "/*! @file %s"NEWLINES, gnu_basename(cFileName));
|
|
|
|
fprintf(fileDesc, "/*! @file %s"NEWLINES, gnu_basename(cFileName));
|
|
|
|
fprintf(fileDesc, " * @details"NEWLINES" * This is a user defined stub.\\n"NEWLINES);
|
|
|
|
fprintf(fileDesc, " * @details"NEWLINES" * This is a user defined stub."NEWLINES);
|
|
|
|
fprintf(fileDesc, " * Define additional elements which need to be tested, or helper functions.\\n"NEWLINES);
|
|
|
|
fprintf(fileDesc, " * Define additional elements which need to be tested, or helper functions."NEWLINES);
|
|
|
|
fprintf(fileDesc, " * - generated by stubser %s -"NEWLINES" */" NEWLINES NEWLINES, GITVERSION);
|
|
|
|
fprintf(fileDesc, " * - generated by stubser %s -"NEWLINES" */" NEWLINES NEWLINES, GITVERSION);
|
|
|
|
|
|
|
|
|
|
|
|
fprintf(fileDesc, "#include <CUnit/CUnit.h>"NEWLINES);
|
|
|
|
fprintf(fileDesc, "#include <CUnit/CUnit.h>"NEWLINES);
|
|
|
|
@@ -980,7 +991,7 @@ STATIC int8_t createStub(char *aOutput, char *aNoSuffix, cfile_t *aCfile)
|
|
|
|
createUserFiles(aOutput, aNoSuffix, vaListAvailable);
|
|
|
|
createUserFiles(aOutput, aNoSuffix, vaListAvailable);
|
|
|
|
|
|
|
|
|
|
|
|
fprintf(cfile, "/*! @file %s"NEWLINES, gnu_basename(cFileName));
|
|
|
|
fprintf(cfile, "/*! @file %s"NEWLINES, gnu_basename(cFileName));
|
|
|
|
fprintf(cfile, " * @details"NEWLINES" * This is a stub for CUnit.\\n"NEWLINES);
|
|
|
|
fprintf(cfile, " * @details"NEWLINES" * This is a stub for CUnit."NEWLINES);
|
|
|
|
fprintf(cfile, " * - generated by stubser %s -"NEWLINES" */" NEWLINES NEWLINES, GITVERSION);
|
|
|
|
fprintf(cfile, " * - generated by stubser %s -"NEWLINES" */" NEWLINES NEWLINES, GITVERSION);
|
|
|
|
fprintf(cfile, "#include <CUnit/CUnit.h>"NEWLINES);
|
|
|
|
fprintf(cfile, "#include <CUnit/CUnit.h>"NEWLINES);
|
|
|
|
fprintf(cfile, "#include <stdint.h>"NEWLINES);
|
|
|
|
fprintf(cfile, "#include <stdint.h>"NEWLINES);
|
|
|
|
@@ -988,6 +999,9 @@ STATIC int8_t createStub(char *aOutput, char *aNoSuffix, cfile_t *aCfile)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fprintf(cfile, "#include <stdarg.h> // stub uses a va_list"NEWLINES);
|
|
|
|
fprintf(cfile, "#include <stdarg.h> // stub uses a va_list"NEWLINES);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(cfile, "#if __has_include(\"stub_%s_init.h\")"NEWLINES, aNoSuffix);
|
|
|
|
|
|
|
|
fprintf(cfile, "#\tinclude \"stub_%s_init.h\""NEWLINES, aNoSuffix);
|
|
|
|
|
|
|
|
fprintf(cfile, "#endif"NEWLINES);
|
|
|
|
fprintf(cfile, "#include \"stub_%s_user.h\""NEWLINES, aNoSuffix);
|
|
|
|
fprintf(cfile, "#include \"stub_%s_user.h\""NEWLINES, aNoSuffix);
|
|
|
|
fprintf(cfile, "#include \"%s\""NEWLINES NEWLINES, gnu_basename(cHeaderName));
|
|
|
|
fprintf(cfile, "#include \"%s\""NEWLINES NEWLINES, gnu_basename(cHeaderName));
|
|
|
|
|
|
|
|
|
|
|
|
@@ -998,7 +1012,7 @@ STATIC int8_t createStub(char *aOutput, char *aNoSuffix, cfile_t *aCfile)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fprintf(cheader, "/*! @file %s"NEWLINES, gnu_basename(cHeaderName));
|
|
|
|
fprintf(cheader, "/*! @file %s"NEWLINES, gnu_basename(cHeaderName));
|
|
|
|
fprintf(cheader, " * @details"NEWLINES" * This is a stub header.\\n"NEWLINES);
|
|
|
|
fprintf(cheader, " * @details"NEWLINES" * This is a stub header."NEWLINES);
|
|
|
|
fprintf(cheader, " * - generated by stubser %s -"NEWLINES" */" NEWLINES NEWLINES, GITVERSION);
|
|
|
|
fprintf(cheader, " * - generated by stubser %s -"NEWLINES" */" NEWLINES NEWLINES, GITVERSION);
|
|
|
|
|
|
|
|
|
|
|
|
fprintf(cheader, "#ifndef _STUB_%s_H"NEWLINES, aNoSuffix);
|
|
|
|
fprintf(cheader, "#ifndef _STUB_%s_H"NEWLINES, aNoSuffix);
|
|
|
|
|