diff --git a/README.md b/README.md index cb31bd9..69afaf4 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ The following file extensions are checked: * `.cxx` * `.ino` * `.pde` + * `.cu` * Protobuf files: * `.proto` diff --git a/check.sh b/check.sh index 41cc77a..2bf4cdb 100755 --- a/check.sh +++ b/check.sh @@ -5,10 +5,10 @@ ############################################################################### # USAGE: ./entrypoint.sh [] [] # -# Checks all C/C++/Protobuf files (.h, .H, .hpp, .hh, .h++, .hxx and .c, .C, -# .cpp, .cc, .c++, .cxx, .proto) in the provided GitHub repository path +# Checks all C/C++/Protobuf/CUDA files (.h, .H, .hpp, .hh, .h++, .hxx and .c, .C, +# .cpp, .cc, .c++, .cxx, .proto, .cu) in the provided GitHub repository path # (arg1) for conforming to clang-format. If no path is provided or provided path -# is not a directory, all C/C++/Protobuf files are checked. If any files are +# is not a directory, all C/C++/Protobuf/CUDA files are checked. If any files are # incorrectly formatted, the script lists them and exits with 1. # # Define your own formatting rules in a .clang-format file at your repository @@ -16,7 +16,7 @@ # format_diff function # Accepts a filepath argument. The filepath passed to this function must point -# to a C/C++/Protobuf file. +# to a C/C++/Protobuf/CUDA file. format_diff() { local filepath="$1" # Invoke clang-format with dry run and formatting error output @@ -62,12 +62,13 @@ fi exit_code=0 # All files improperly formatted will be printed to the output. -# find all C/C++/Protobuf files: +# find all C/C++/Protobuf/CUDA files: # h, H, hpp, hh, h++, hxx # c, C, cpp, cc, c++, cxx # ino, pde # proto -src_files=$(find "$CHECK_PATH" -name .git -prune -o -regextype posix-egrep -regex '^.*\.((((c|C)(c|pp|xx|\+\+)?$)|((h|H)h?(pp|xx|\+\+)?$))|(ino|pde)|(proto))$' -print) +# cu +src_files=$(find "$CHECK_PATH" -name .git -prune -o -regextype posix-egrep -regex '^.*\.((((c|C)(c|pp|xx|\+\+)?$)|((h|H)h?(pp|xx|\+\+)?$))|(ino|pde|proto|cu))$' -print) # check formatting in each source file for file in $src_files; do diff --git a/test/known_fail/addition.cu b/test/known_fail/addition.cu new file mode 100755 index 0000000..84dd741 --- /dev/null +++ b/test/known_fail/addition.cu @@ -0,0 +1,16 @@ +/* Addition program */ +#include + +main() +{ + int integer1, integer2,sum; /* declaration before any executable statements*/ + + printf("Enter first integer\n"); /* prompt */ + scanf("%d", &integer1); /* read an integer */ + printf("Enter second integer\n"); /* prompt */ + scanf("%d", &integer2); /* read an integer */ + sum = integer1 + integer2; /* assignment of sum */ + printf("Sum is %d\n", sum); /* print sum */ + + return 0; /* Indicate program ended successfully */ +} diff --git a/test/known_pass/addition.cu b/test/known_pass/addition.cu new file mode 100755 index 0000000..ea6fe7c --- /dev/null +++ b/test/known_pass/addition.cu @@ -0,0 +1,17 @@ +/* Addition program */ +#include + +main() +{ + int integer1, integer2, + sum; /* declaration before any executable statements*/ + + printf("Enter first integer\n"); /* prompt */ + scanf("%d", &integer1); /* read an integer */ + printf("Enter second integer\n"); /* prompt */ + scanf("%d", &integer2); /* read an integer */ + sum = integer1 + integer2; /* assignment of sum */ + printf("Sum is %d\n", sum); /* print sum */ + + return 0; /* Indicate program ended successfully */ +}