| 596 | ****************************************************************************/ |
| 597 | |
| 598 | static int enum_board_configurations(const char *dirpath, |
| 599 | struct dirent *entry, void *arg) |
| 600 | { |
| 601 | char *configpath; |
| 602 | char *varvalue; |
| 603 | int ret = 0; |
| 604 | |
| 605 | /* All board directories should contain a defconfig file. */ |
| 606 | |
| 607 | ret = asprintf(&configpath, "%s%c%s%cdefconfig", |
| 608 | dirpath, g_delim, entry->d_name, g_delim); |
| 609 | if (ret < 0) |
| 610 | { |
| 611 | fprintf(stderr, |
| 612 | "ERROR: asprintf() failed to configpath\n"); |
| 613 | return ret; |
| 614 | } |
| 615 | |
| 616 | if (test_filepath(configpath)) |
| 617 | { |
| 618 | /* We don't want all board configurations, we only want the name of |
| 619 | * the board that includes a configuration with: |
| 620 | * |
| 621 | * CONFIG_ARCH_CHIP="xxxx" |
| 622 | * |
| 623 | * Where xxxx is the selected MCU name. |
| 624 | */ |
| 625 | |
| 626 | ret = asprintf(&varvalue, "\"%s\"", g_selected_mcu); |
| 627 | if (ret < 0) |
| 628 | { |
| 629 | fprintf(stderr, |
| 630 | "ERROR: asprintf() failed to varvalue\n"); |
| 631 | return ret; |
| 632 | } |
| 633 | |
| 634 | if (check_variable(configpath, "CONFIG_ARCH_CHIP", varvalue)) |
| 635 | { |
| 636 | /* Found it... add the board name to the list of boards for the |
| 637 | * selected MCU. |
| 638 | */ |
| 639 | |
| 640 | if (g_nboard >= MAX_BOARDS) |
| 641 | { |
| 642 | fprintf(stderr, |
| 643 | "ERROR: Too many board configurations found\n"); |
| 644 | exit(EXIT_FAILURE); |
| 645 | } |
| 646 | |
| 647 | g_board[g_nboard] = strdup(arg); |
| 648 | g_nboard++; |
| 649 | |
| 650 | /* If we have not yet extracted the architecture family, then do |
| 651 | * that here. |
| 652 | */ |
| 653 | |
| 654 | if (g_selected_family == NULL) |
| 655 | { |
nothing calls this directly
no test coverage detected