Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix various issues with the testsuite

 Hide some errors output to stdout and which are confusing to the user
 (although there remains lots of such cases)
 Handle cases where the installation directory is not the same as
 gprbuild (since a sve_views.gpr was then not found by the testsuite,
 resulting in an error)
(sve_converter.adb): fix exit status in some cases (regression from
 previous GNAT.Command_Line conversion)
  • Loading branch information...
commit caa8bc819c385375df79d09c5b04fe1735e76470 1 parent 8491224
Emmanuel Briot authored
View
40 Makefile
@@ -1,16 +1,11 @@
-
-
-
gnat=
naturaldocs=
GNATMAKE=${gnat}gnatmake
GNATCLEAN=${gnat}gnatclean
GNATFLAGS=-gnat05 -gnaty -gnatwe -gnatwa
-
prefix=$(shell which ${GNATMAKE} 2> /dev/null | sed -e 's/\/bin\/gnatmake.*//')
-
# vars
TARGET_SVE_DIR=${prefix}/bin
TARGET_SVE_CONFIG_DIR=${prefix}/bin
@@ -26,6 +21,7 @@ TARGET_SVE_CONFIG_DIR=${prefix}/bin
LIB_NAME=sve_views
TARGET_LIB_DIR=${prefix}/lib
TARGET_LIB_GNAT_DIR=${TARGET_LIB_DIR}/gnat
+export TARGET_LIB_GNAT_DIR
TARGET_VIEW_LIB_DIR=${TARGET_LIB_DIR}/${LIB_NAME}
TARGET_VIEW_LIB_STATIC_DIR=${TARGET_VIEW_LIB_DIR}/static
TARGET_VIEW_INCLUDE_DIR=${prefix}/include/${LIB_NAME}
@@ -131,21 +127,21 @@ test-sve: test-sve-compile test-sve-unit test-sve-accept
test-views: test-views-compile test-views-unit
test-sve-compile :
- cd ${SVE}/${TEST_DIR} && ${GNATMAKE} -p -P sve_test.gpr
-test-sve-unit: test-sve-compile
+ cd ${SVE}/${TEST_DIR} && ${GNATMAKE} -q -p -P sve_test.gpr
+test-sve-unit: clean-sve-test-gcov test-sve-compile
cd ${SVE}/${TEST_DIR}/${BIN_DIR} && ./${SVE_TEST_U}
-test-sve-accept: test-sve-compile
+test-sve-accept: clean-sve-test-gcov test-sve-compile
cd ${SVE}/${TEST_DIR}/${BIN_DIR} && ./${SVE_TEST_A_SH}
-test-sve-gcov-unit: clean-sve-test test-sve-unit
+test-sve-gcov-unit: test-sve-unit
cd ${SVE}/${TEST_DIR} && gcov -o obj/ ../${SVE_DIR}/${SRC_DIR}/*
-test-sve-gcov-accept: clean-sve-test test-sve-accept
+test-sve-gcov-accept: test-sve-accept
cd ${SVE}/${TEST_DIR} && gcov -o obj/ ../${SVE_DIR}/${SRC_DIR}/*
test-views-compile :
- cd ${VIEW}/${TEST_DIR} && ${GNATMAKE} -p -P sve_views_test.gpr
-test-views-unit: test-views-compile
+ cd ${VIEW}/${TEST_DIR} && ${GNATMAKE} -q -p -P sve_views_test.gpr
+test-views-unit: test-views-compile clean-views-test-gcov
cd ${VIEW}/${TEST_DIR}/${BIN_DIR} && ./${VIEW_TEST_U}
-test-views-gcov-unit: clean-views-test test-views-unit
+test-views-gcov-unit: test-views-unit
cd ${VIEW}/${TEST_DIR} && gcov -o obj/ ../${VIEW_DIR}/${SRC_DIR}/*
# DOCS --------------------
@@ -169,14 +165,18 @@ clean-views:
clean-test: clean-sve-test clean-views-test
-clean-sve-test:
+clean-sve-test-gcov:
+ @cd ${SVE}/${TEST_DIR} && rm -f *.gcov
+ @cd ${SVE}/${TEST_DIR} && rm -f ${OBJ_DIR}/*.gcda ${OBJ_DIR}/*.gcno
+
+clean-sve-test: clean-sve-test-gcov
cd ${SVE}/${TEST_DIR} && ${GNATCLEAN} -P sve_test.gpr
- cd ${SVE}/${TEST_DIR} && rm -f *.gcov
- cd ${SVE}/${TEST_DIR} && rm -f ${OBJ_DIR}/*.gcda ${OBJ_DIR}/*.gcno
-clean-views-test:
+clean-views-test-gcov:
+ @cd ${VIEW}/${TEST_DIR} && rm -f *.gcov
+ @cd ${VIEW}/${TEST_DIR} && rm -f ${OBJ_DIR}/*.gcda ${OBJ_DIR}/*.gcno
+
+clean-views-test: clean-views-test-gcov
cd ${VIEW}/${TEST_DIR} && ${GNATCLEAN} -P sve_views_test.gpr
- cd ${VIEW}/${TEST_DIR} && rm -f *.gcov
- cd ${VIEW}/${TEST_DIR} && rm -f ${OBJ_DIR}/*.gcda ${OBJ_DIR}/*.gcno
-
+
View
13 sve_library/test/src/views-assertions-functions-test.adb
@@ -51,14 +51,13 @@ package body Views.Assertions.Functions.Test is
end Register_Tests;
+ ----------------------
+ -- Test_Valid_XHTML --
+ ----------------------
procedure Test_Valid_XHTML (T : in out Test_Case'Class) is
-
pragma Unreferenced (T);
-
-
begin
-
Assert (not Valid_XHTML (""), "test 1 failed");
Assert (Valid_XHTML ("<html></html>"), "test 2 failed");
-- Assert (Valid_XHTML (
@@ -77,6 +76,7 @@ package body Views.Assertions.Functions.Test is
--------------------------------
-- Test_Validate_Node_For_Tag --
--------------------------------
+
procedure Test_Validate_Node_For_Tag
(T : in out Test_Case'Class) is
@@ -313,7 +313,7 @@ package body Views.Assertions.Functions.Test is
Set_Feature (Reader, Validation_Feature, False);
Set_Feature (Reader, Namespace_Feature, True);
-
+ Set_System_Id (Input, "<variable Test_Validate_Node_For_Tag>");
Parse (Reader, Input);
Close (Input);
@@ -523,6 +523,7 @@ package body Views.Assertions.Functions.Test is
Open (Content_S, Scheme, Input);
Set_Feature (Reader, Validation_Feature, False);
Set_Feature (Reader, Namespace_Feature, True);
+ Set_System_Id (Input, "<Test_Find_Nodes_With_Tag_Recursive>");
Parse (Reader, Input);
Close (Input);
Doc := Get_Tree (Reader);
@@ -770,6 +771,7 @@ package body Views.Assertions.Functions.Test is
Open (Content_S, Scheme, Input);
Set_Feature (Reader, Validation_Feature, False);
Set_Feature (Reader, Namespace_Feature, True);
+ Set_System_Id (Input, "<Test_Find_Nodes_With_Tag_Array_Recursive>");
Parse (Reader, Input);
Close (Input);
Doc := Get_Tree (Reader);
@@ -1085,7 +1087,6 @@ package body Views.Assertions.Functions.Test is
Tag_Empty : T_Tag;
Tags_Error : constant T_Tags := (1 => Tag_Empty);
begin
-
-- bad xml -> raise error
Assert
(Length
View
3  sve_library/views/src/views-assertions-functions.adb
@@ -19,14 +19,13 @@ package body Views.Assertions.Functions is
-----------------
-- Valid_XHTML --
-----------------
+
function Valid_XHTML (Content : String) return Boolean is
Input : String_Input;
Reader : Validating_Reader;
-
Content_S : constant Byte_Sequence := Content;
begin
-
-- Set_Feature (Reader, Schema_Validation_Feature, True);
Open (Content_S, Scheme, Input);
Parse (Reader, Input);
View
4 sve_program/sve/src/sve.adb
@@ -163,7 +163,7 @@ package body SVE is
if With_Ignored > 0 then
Run := False;
- Display_Error_Command (Option_With & " contains too much" &
+ Display_Error_Command (Option_With & " contains too many " &
" "","" ");
end if;
@@ -182,7 +182,7 @@ package body SVE is
if Use_Ignored > 0 then
Run := False;
- Display_Error_Command (Option_Use & " contains too much " &
+ Display_Error_Command (Option_Use & " contains too many " &
""","" ");
end if;
View
6 sve_program/sve/src/sve_converter.adb
@@ -79,6 +79,7 @@ begin
if not Success_Package_Name then
Display_Error_Command
("Invalid package name : " & Parameter);
+ Set_Exit_Status (Failure);
return;
end if;
@@ -178,4 +179,9 @@ exception
Display_Help;
Set_Exit_Status (Failure);
+
+ when GNAT.Command_Line.Invalid_Parameter =>
+ Display_Error_Command
+ ("Missing parameter for switch " & Full_Switch);
+ Set_Exit_Status (Failure);
end Sve_Converter;
View
68 sve_program/test/bin/sve_test_accept.sh
@@ -7,24 +7,7 @@ output=test_accept.log
rm -f ../accept/sve_converter/generated/*
rm -f $output
-
-if ls | grep -q -e "\.ali"
-then
- rm *.ali
-fi
-if ls | grep -q -e "\.o"
-then
- rm *.o
-fi
-if ls | grep -q -e "\.adb"
-then
- rm *.adb
-fi
-if ls | grep -q -e "\.ads"
-then
- rm *.ads
-fi
-
+rm -f *.ali *.o *.adb *.ads
if (./sve_test_accept)
then
@@ -41,7 +24,7 @@ then
# Test the help
#--------------------------------------------------------------------------------------------------------------------------
echo "Test the help..."
- if !(./sve -help >> $output)
+ if !(./sve -help >> $output 2>&1)
then
echo "FAILED"
is_error=1
@@ -50,7 +33,7 @@ then
# Test a bad argument
#--------------------------------------------------------------------------------------------------------------------------
echo "Test a bad argument..."
- if (./sve -svewith >> $output)
+ if (./sve -svewith >> $output 2>&1)
then
echo "FAILED"
is_error=1
@@ -677,7 +660,7 @@ then
#--------------------------------------------------------------------------------------------------------------------------
echo "Test error missing value for -svewith arg..."
- if (./sve -svewith ${file_path}"sources/test.html.sve" >> $output)
+ if (./sve -svewith ${file_path}"sources/test.html.sve" >> $output 2>&1)
then
echo "FAILED"
is_error=1
@@ -688,7 +671,7 @@ then
#--------------------------------------------------------------------------------------------------------------------------
echo "Test error missing value for -sveuse arg..."
- if (./sve -sveuse ${file_path}"sources/test.html.sve" >> $output)
+ if (./sve -sveuse ${file_path}"sources/test.html.sve" >> $output 2>&1)
then
echo "FAILED"
is_error=1
@@ -721,7 +704,7 @@ then
#--------------------------------------------------------------------------------------------------------------------------
echo "Test error missing value for -svedir arg..."
- if (./sve -svedir ${file_path}"sources/test.html.sve" >> $output)
+ if (./sve ${file_path}"sources/test.html.sve" -svedir >> $output)
then
echo "FAILED"
is_error=1
@@ -731,7 +714,7 @@ then
#--------------------------------------------------------------------------------------------------------------------------
echo "Test error missing value for -svelogdir arg..."
- if (./sve -svelogdir ${file_path}"sources/test.html.sve" >> $output)
+ if (./sve ${file_path}"sources/test.html.sve" -svelogdir >> $output)
then
echo "FAILED"
is_error=1
@@ -878,11 +861,21 @@ then
main_example=${file_path}main_example/
echo "Test the main example, with .gpr (-P)..."
-
+
+ # Make sure sve_views.gpr is visible by the compiler
+ #GPR_PROJECT_PATH=../../../sve_library:${GPS_PROJECT_PATH}
+ #export GPR_PROJECT_PATH
+
+ GPR_PROJECT_PATH=${TARGET_LIB_GNAT_DIR}:${GPR_PROJECT_PATH}
+ export GPR_PROJECT_PATH
+
if !(./sve -P${main_example}"operations_build.gpr" -svelogdir ${main_example}"log" -svedir ${main_example}"view" ${main_example}"operations.html.sve" >> $output)
then
- echo "FAILED (do you run 'make install' ?)"
+ echo "FAILED (did you run 'make prefix=... install' ?)"
+ echo "You need to specify the same prefix when running tests:"
+ echo " make prefix=... test"
is_error=1
+
else # did not failed
# verify if generated files exist
if !(test -f ${main_example}"view/operations.adb" && test -f ${main_example}"view/operations.ads")
@@ -916,7 +909,7 @@ then
if !(./sve -P ${main_example}"operations_build.gpr" -svelogdir ${main_example}"log" -svedir ${main_example}"view" ${main_example}"operations.html.sve" >> $output)
then
- echo "FAILED (do you run 'make install' ?)"
+ echo "FAILED (did you run 'make install' ?)"
is_error=1
else # did not failed
# verify if generated files exist
@@ -950,26 +943,7 @@ then
# ----------------------------------------------------------------------------------------
# delete all generated files
rm -f ${file_path}generated/*
-
-
- if ls | grep -q -e "\.ali"
- then
- rm *.ali
- fi
- if ls | grep -q -e "\.o"
- then
- rm *.o
- fi
- if ls | grep -q -e "\.adb"
- then
- rm *.adb
- fi
- if ls | grep -q -e "\.ads"
- then
- rm *.ads
- fi
-
-
+ rm -f *.ali *.o *.adb *.ads
# display
echo "----------------------"
Please sign in to comment.
Something went wrong with that request. Please try again.