Skip to content

Commit 61a55fe

Browse files
committed
Sort all find outputs
find doesn't have any specific output order. This was causing unit tests to sometimes fail. Sorted output will also be more user-friendly.
1 parent da85525 commit 61a55fe

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Diff for: arduino-ci-script.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@ function check_sketch_structure() {
13731373
exitStatus=$(set_exit_status "$exitStatus" $((ARDUINO_CI_SCRIPT_CHECK_SKETCH_STRUCTURE_CHECK_FOLDER_NAME_OFFSET + checkFolderNameExitStatus)))
13741374
fi
13751375

1376-
done <<<"$(find "$normalizedSearchPath" -type f \( -iname '*.ino' -or -iname '*.pde' \) -printf '%h\n' | sort --unique)"
1376+
done <<<"$(find "$normalizedSearchPath" -type f \( -iname '*.ino' -or -iname '*.pde' \) -printf '%h\n' | sort --dictionary-order --unique)"
13771377
return "$exitStatus"
13781378
}
13791379

@@ -1471,7 +1471,7 @@ function check_library_structure() {
14711471

14721472
echo "ERROR: ${spuriousDotFolderPath}: Causes the Arduino IDE to display a spurious folder warning."
14731473
exitStatus=$(set_exit_status "$exitStatus" $ARDUINO_CI_SCRIPT_CHECK_LIBRARY_STRUCTURE_SPURIOUS_DOT_FOLDER_EXIT_STATUS)
1474-
done <<<"$(find "$normalizedLibraryPath" -maxdepth 1 -type d -regex '^.*/\..*$' -not -name '.git' -not -name '.github' -not -name '.svn' -not -name '.hg' -not -name '.bzr' -not -name '.vscode')"
1474+
done <<<"$(find "$normalizedLibraryPath" -maxdepth 1 -type d -regex '^.*/\..*$' -not -name '.git' -not -name '.github' -not -name '.svn' -not -name '.hg' -not -name '.bzr' -not -name '.vscode' | sort --dictionary-order)"
14751475

14761476
# Check for incorrect spelling of extras folder
14771477
if [[ $(find "$normalizedLibraryPath" -maxdepth 1 -type d -and -iregex '^.*/extras?$') && ! $(find "$normalizedLibraryPath" -maxdepth 1 -type d -and -name 'extras') ]]; then
@@ -1507,7 +1507,7 @@ function check_library_structure() {
15071507

15081508
echo "ERROR: ${normalizedLibraryPropertiesPath}: Stray file. library.properties should be located in the library root folder."
15091509
exitStatus=$(set_exit_status "$exitStatus" $ARDUINO_CI_SCRIPT_CHECK_LIBRARY_STRUCTURE_STRAY_LIBRARY_PROPERTIES_EXIT_STATUS)
1510-
done <<<"$(find "$normalizedLibraryPath/src" -maxdepth 1 -type f -iname 'library.properties')"
1510+
done <<<"$(find "$normalizedLibraryPath/src" -maxdepth 1 -type f -iname 'library.properties' | sort --dictionary-order)"
15111511
fi
15121512

15131513
# Check for missing keywords.txt file
@@ -1525,7 +1525,7 @@ function check_library_structure() {
15251525

15261526
echo "ERROR: ${keywordsTxtPath}: Stray file. keywords.txt should be located in the library root folder."
15271527
exitStatus=$(set_exit_status "$exitStatus" $ARDUINO_CI_SCRIPT_CHECK_LIBRARY_STRUCTURE_STRAY_KEYWORDS_TXT_EXIT_STATUS)
1528-
done <<<"$(find "$normalizedLibraryPath/src" -maxdepth 1 -type f -iname 'keywords.txt')"
1528+
done <<<"$(find "$normalizedLibraryPath/src" -maxdepth 1 -type f -iname 'keywords.txt' | sort --dictionary-order)"
15291529
fi
15301530

15311531
# Check for sketch files outside of the src or extras folders
@@ -1550,7 +1550,7 @@ function check_library_structure() {
15501550
fi
15511551
fi
15521552

1553-
done <<<"$(find "$normalizedBasePath" -mindepth "$depth" -maxdepth "$depth" -type d)"
1553+
done <<<"$(find "$normalizedBasePath" -mindepth "$depth" -maxdepth "$depth" -type d | sort --dictionary-order)"
15541554

15551555
return "$exitStatus"
15561556
}
@@ -1723,7 +1723,7 @@ function check_library_properties() {
17231723
echo "ERROR: ${foundLibraryPropertiesPath}: Incorrect filename case. This causes it to not be recognized on a filename case-sensitive OS such as Linux. It must be exactly \"library.properties\"."
17241724
exitStatus=$(set_exit_status "$exitStatus" $ARDUINO_CI_SCRIPT_CHECK_LIBRARY_PROPERTIES_INCORRECT_FILENAME_CASE_EXIT_STATUS)
17251725
fi
1726-
done <<<"$(find "$normalizedLibraryPropertiesPath" -maxdepth 1 -type f -iname 'library.properties')"
1726+
done <<<"$(find "$normalizedLibraryPropertiesPath" -maxdepth 1 -type f -iname 'library.properties' | sort --dictionary-order)"
17271727

17281728
# Check whether the folder contains a library.properties file
17291729
if [[ "$libraryPropertiesFound" == false ]]; then
@@ -2036,7 +2036,7 @@ function check_library_properties() {
20362036
exitStatus=$(set_exit_status "$exitStatus" $ARDUINO_CI_SCRIPT_CHECK_LIBRARY_PROPERTIES_LDFLAGS_MISSPELLED_EXIT_STATUS)
20372037
fi
20382038

2039-
done <<<"$(find "$normalizedLibraryPropertiesSearchPath" -maxdepth "$maximumSearchDepth" -type d)"
2039+
done <<<"$(find "$normalizedLibraryPropertiesSearchPath" -maxdepth "$maximumSearchDepth" -type d | sort --dictionary-order)"
20402040

20412041
return "$exitStatus"
20422042
}
@@ -2121,7 +2121,7 @@ function check_keywords_txt() {
21212121
echo "ERROR: ${foundKeywordsTxtPath}: Incorrect filename case, which causes it to not be recognized on a filename case-sensitive OS such as Linux. It must be exactly \"keywords.txt\"."
21222122
exitStatus=$(set_exit_status "$exitStatus" $ARDUINO_CI_SCRIPT_CHECK_KEYWORDS_TXT_INCORRECT_FILENAME_CASE_EXIT_STATUS)
21232123
fi
2124-
done <<<"$(find "$normalizedKeywordsTxtPath" -maxdepth 1 -type f -iname 'keywords.txt')"
2124+
done <<<"$(find "$normalizedKeywordsTxtPath" -maxdepth 1 -type f -iname 'keywords.txt' | sort --dictionary-order)"
21252125

21262126
# Check whether the folder contains a keywords.txt file
21272127
if [[ "$keywordsTxtFound" == false ]]; then
@@ -2301,7 +2301,7 @@ function check_keywords_txt() {
23012301
done <<<"$keywordsTxtCRline"
23022302
done <"${normalizedKeywordsTxtPath}/keywords.txt"
23032303

2304-
done <<<"$(find "$normalizedKeywordsTxtSearchPath" -maxdepth "$maximumSearchDepth" -type d)"
2304+
done <<<"$(find "$normalizedKeywordsTxtSearchPath" -maxdepth "$maximumSearchDepth" -type d | sort --dictionary-order)"
23052305

23062306
return "$exitStatus"
23072307
}

0 commit comments

Comments
 (0)