Skip to content

Commit e2b26ee

Browse files
authored
Make and generate_code.sh generate same outputs (#6855)
* added --bfbs-builtins * update generate_code.bat * forgot the . * updated checking scripts * added bypass for the monster_test.bfbs and arrays_test.bfbs diff issue * removed check on windows for now
1 parent 9d686bf commit e2b26ee

File tree

7 files changed

+668
-647
lines changed

7 files changed

+668
-647
lines changed

.appveyor/check-generate-code.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ goto SUCCESS
2727
:DIFFFOUND
2828
@echo "" >&2
2929
@echo "ERROR: ********************************************************" >&2
30-
@echo "ERROR: The following differences were found after running the" >&2
31-
@echo "ERROR: tests/generate_code.sh script. Maybe you forgot to run" >&2
32-
@echo "ERROR: it after making changes in a generator or schema?" >&2
30+
@echo "ERROR: The following differences were found after building." >&2
31+
@echo "ERROR: Perhaps there is a difference in the flags for the" >&2
32+
@echo "ERROR: CMakeLists.txt vs the tests/generate_code.bat script?" >&2
3333
@echo "ERROR: ********************************************************" >&2
3434
@echo "" >&2
3535
@git -c core.autocrlf=true --no-pager diff --binary

samples/monster.bfbs

24 Bytes
Binary file not shown.

scripts/check-generate-code.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515
# limitations under the License.
1616
set -e
1717

18+
if ! git diff --quiet; then
19+
echo >&2
20+
echo "ERROR: ********************************************************" >&2
21+
echo "ERROR: The following differences were found after building." >&2
22+
echo "ERROR: Perhaps there is a difference in the flags for the" >&2
23+
echo "ERROR: CMakeLists.txt vs the tests/generate_code.sh script?" >&2
24+
echo "ERROR: ********************************************************" >&2
25+
echo >&2
26+
git diff --binary --exit-code
27+
fi
28+
1829
cd tests
1930
./generate_code.sh
2031
cd ..

tests/arrays_test.bfbs

56 Bytes
Binary file not shown.

tests/generate_code.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ set TEST_NOINCL_FLAGS=%TEST_BASE_FLAGS% --no-includes
5454
..\%buildtype%\flatc.exe --rust %TEST_RUST_FLAGS% -I include_test -o include_test1 include_test/include_test1.fbs || goto FAIL
5555
..\%buildtype%\flatc.exe --rust %TEST_RUST_FLAGS% -I include_test -o include_test2 include_test/sub/include_test2.fbs || goto FAIL
5656
..\%buildtype%\flatc.exe -b --schema --bfbs-comments --bfbs-filenames . --bfbs-builtins -I include_test monster_test.fbs || goto FAIL
57-
..\%buildtype%\flatc.exe --cpp --bfbs-comments --bfbs-builtins --bfbs-gen-embed %TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% -I include_test monster_test.fbs || goto FAIL
58-
..\%buildtype%\flatc.exe -b --schema --bfbs-comments --bfbs-builtins -I include_test arrays_test.fbs || goto FAIL
57+
..\%buildtype%\flatc.exe --cpp --bfbs-comments --bfbs-filenames . --bfbs-builtins --bfbs-gen-embed %TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% -I include_test monster_test.fbs || goto FAIL
58+
..\%buildtype%\flatc.exe -b --schema --bfbs-comments --bfbs-filenames . --bfbs-builtins -I include_test arrays_test.fbs || goto FAIL
5959
..\%buildtype%\flatc.exe --jsonschema --schema -I include_test monster_test.fbs || goto FAIL
6060
..\%buildtype%\flatc.exe --cpp --java --csharp --jsonschema %TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% %TEST_CS_FLAGS% --scoped-enums arrays_test.fbs || goto FAIL
6161
..\%buildtype%\flatc.exe --rust %TEST_RUST_FLAGS% -o arrays_test arrays_test.fbs || goto FAIL
@@ -98,7 +98,7 @@ if NOT "%MONSTER_EXTRA%"=="skip" (
9898

9999
cd ../samples
100100
..\%buildtype%\flatc.exe --cpp --lobster %TEST_BASE_FLAGS% %TEST_CPP_FLAGS% monster.fbs || goto FAIL
101-
..\%buildtype%\flatc.exe -b --schema --bfbs-comments --bfbs-builtins monster.fbs || goto FAIL
101+
..\%buildtype%\flatc.exe -b --schema --bfbs-comments --bfbs-filenames . --bfbs-builtins monster.fbs || goto FAIL
102102
cd ../reflection
103103
call generate_code.bat %1 %2 || goto FAIL
104104

tests/generate_code.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS $TEST_TS_FLAGS -o namespace_te
5252
../flatc --rust $TEST_RUST_FLAGS -o include_test1 -I include_test include_test/include_test1.fbs
5353
../flatc --rust $TEST_RUST_FLAGS -o include_test2 -I include_test include_test/sub/include_test2.fbs
5454
../flatc -b --schema --bfbs-comments --bfbs-filenames . --bfbs-builtins -I include_test monster_test.fbs
55-
../flatc --cpp --bfbs-comments --bfbs-builtins --bfbs-gen-embed $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS -I include_test monster_test.fbs
56-
../flatc -b --schema --bfbs-comments --bfbs-builtins -I include_test arrays_test.fbs
55+
../flatc --cpp --bfbs-comments --bfbs-filenames . --bfbs-builtins --bfbs-gen-embed $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS -I include_test monster_test.fbs
56+
../flatc -b --schema --bfbs-comments --bfbs-filenames . --bfbs-builtins -I include_test arrays_test.fbs
5757
../flatc --jsonschema --schema -I include_test monster_test.fbs
5858
../flatc --cpp --java --kotlin --csharp --python $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS monster_extra.fbs monsterdata_extra.json
5959
../flatc --cpp --java --csharp --jsonschema $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS --scoped-enums arrays_test.fbs
@@ -109,6 +109,6 @@ TEST_CPP17_FLAGS="--cpp --cpp-std c++17 --cpp-static-reflection --gen-object-api
109109
cd ../samples
110110
../flatc --cpp --lobster $TEST_BASE_FLAGS $TEST_CPP_FLAGS monster.fbs
111111
../flatc --rust $TEST_RUST_FLAGS -o rust_generated monster.fbs
112-
../flatc -b --schema --bfbs-comments --bfbs-builtins monster.fbs
112+
../flatc -b --schema --bfbs-filenames . --bfbs-comments --bfbs-builtins monster.fbs
113113
cd ../reflection
114114
./generate_code.sh --cpp-std c++0x

0 commit comments

Comments
 (0)