From 06295d3318c91da7e92e84aef9f7bdba1ff30b89 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 7 Dec 2012 09:56:32 +0100 Subject: msibuild: add testcases --- tests/data/button.txt | 7 ++ tests/data/columns.txt | 194 +++++++++++++++++++++++++++++++ tests/data/icon.txt | 4 + tests/data/icon/firefox.16.0.2.0.ico.exe | Bin 0 -> 25214 bytes tests/data/tables.txt | 41 +++++++ tests/testsuite.at | 162 ++++++++++++++++++++++++++ 6 files changed, 408 insertions(+) create mode 100644 tests/data/button.txt create mode 100644 tests/data/columns.txt create mode 100644 tests/data/icon.txt create mode 100644 tests/data/icon/firefox.16.0.2.0.ico.exe create mode 100644 tests/data/tables.txt (limited to 'tests') diff --git a/tests/data/button.txt b/tests/data/button.txt new file mode 100644 index 0000000..6412fe0 --- /dev/null +++ b/tests/data/button.txt @@ -0,0 +1,7 @@ +Property Order Value X Y Width Height Text Help +s72 i2 s64 i2 i2 i2 i2 L0 L50 +RadioButton Property Order +IAgree 1 Yes 5 0 250 15 {\DlgFont8}I &accept the terms in the License Agreement +IAgree 2 No 5 20 250 15 {\DlgFont8}I &do not accept the terms in the License Agreement +AppsShutdownOption 1 All 5 5 320 15 Automatically &close applications and attempt to restart them after setup is complete. +AppsShutdownOption 2 None 5 25 320 15 Do ¬ close applications. (A Reboot will be required.) diff --git a/tests/data/columns.txt b/tests/data/columns.txt new file mode 100644 index 0000000..8e03597 --- /dev/null +++ b/tests/data/columns.txt @@ -0,0 +1,194 @@ +Table Number Name Type +s64 i2 s64 i2 +_Columns +AdminExecuteSequence 1 Action 11592 +AdminExecuteSequence 2 Condition 7679 +AdminExecuteSequence 3 Sequence 5378 +AdminUISequence 1 Action 11592 +AdminUISequence 2 Condition 7679 +AdminUISequence 3 Sequence 5378 +AdvtExecuteSequence 1 Action 11592 +AdvtExecuteSequence 2 Condition 7679 +AdvtExecuteSequence 3 Sequence 5378 +BBControl 1 Billboard_ 11570 +BBControl 2 BBControl 11570 +BBControl 3 Type 3378 +BBControl 4 X 1282 +BBControl 5 Y 1282 +BBControl 6 Width 1282 +BBControl 7 Height 1282 +BBControl 8 Attributes 4356 +BBControl 9 Text 7986 +Binary 1 Name 11592 +Binary 2 Data 2304 +CheckBox 1 Property 11592 +CheckBox 2 Value 7488 +Property 1 Property 11592 +Property 2 Value 3840 +ComboBox 1 Property 11592 +ComboBox 2 Order 9474 +ComboBox 3 Value 3392 +ComboBox 4 Text 8000 +Control 1 Dialog_ 11592 +Control 2 Control 11570 +Control 3 Type 3348 +Control 4 X 1282 +Control 5 Y 1282 +Control 6 Width 1282 +Control 7 Height 1282 +Control 8 Attributes 4356 +Control 9 Property 7474 +Control 10 Text 7936 +Control 11 Control_Next 7474 +Control 12 Help 7986 +ActionText 1 Action 11592 +ActionText 2 Description 7936 +ActionText 3 Template 7936 +Icon 1 Name 11592 +Icon 2 Data 2304 +ListBox 1 Property 11592 +ListBox 2 Order 9474 +ListBox 3 Value 3392 +ListBox 4 Text 8000 +ControlCondition 1 Dialog_ 11592 +ControlCondition 2 Control_ 11570 +ControlCondition 3 Action 11570 +ControlCondition 4 Condition 11775 +ControlEvent 1 Dialog_ 11592 +ControlEvent 2 Control_ 11570 +ControlEvent 3 Event 11570 +ControlEvent 4 Argument 11775 +ControlEvent 5 Condition 15871 +ControlEvent 6 Ordering 5378 +Dialog 1 Dialog 11592 +Dialog 2 HCentering 1282 +Dialog 3 VCentering 1282 +Dialog 4 Width 1282 +Dialog 5 Height 1282 +Dialog 6 Attributes 4356 +Dialog 7 Title 8064 +Dialog 8 Control_First 3378 +Dialog 9 Control_Default 7474 +Dialog 10 Control_Cancel 7474 +EventMapping 1 Dialog_ 11592 +EventMapping 2 Control_ 11570 +EventMapping 3 Event 11570 +EventMapping 4 Attribute 3378 +InstallExecuteSequence 1 Action 11592 +InstallExecuteSequence 2 Condition 7679 +InstallExecuteSequence 3 Sequence 5378 +InstallUISequence 1 Action 11592 +InstallUISequence 2 Condition 7679 +InstallUISequence 3 Sequence 5378 +ListView 1 Property 11592 +ListView 2 Order 9474 +ListView 3 Value 3392 +ListView 4 Text 8000 +ListView 5 Binary_ 7496 +RadioButton 1 Property 11592 +RadioButton 2 Order 9474 +RadioButton 3 Value 3392 +RadioButton 4 X 1282 +RadioButton 5 Y 1282 +RadioButton 6 Width 1282 +RadioButton 7 Height 1282 +RadioButton 8 Text 7936 +RadioButton 9 Help 7986 +TextStyle 1 TextStyle 11592 +TextStyle 2 FaceName 3360 +TextStyle 3 Size 1282 +TextStyle 4 Color 4356 +TextStyle 5 StyleBits 5378 +UIText 1 Key 11592 +UIText 2 Text 8191 +_Validation 1 Table 11552 +_Validation 2 Column 11552 +_Validation 3 Nullable 3332 +_Validation 4 MinValue 4356 +_Validation 5 MaxValue 4356 +_Validation 6 KeyTable 7679 +_Validation 7 KeyColumn 5378 +_Validation 8 Category 7456 +_Validation 9 Set 7679 +_Validation 10 Description 7679 +Feature 1 Feature 11558 +Feature 2 Feature_Parent 7462 +Feature 3 Title 8000 +Feature 4 Description 8191 +Feature 5 Display 5378 +Feature 6 Level 1282 +Feature 7 Directory_ 7496 +Feature 8 Attributes 1282 +File 1 File 11592 +File 2 Component_ 3400 +File 3 FileName 4095 +File 4 FileSize 260 +File 5 Version 7496 +File 6 Language 7444 +File 7 Attributes 5378 +File 8 Sequence 1282 +Directory 1 Directory 11592 +Directory 2 Directory_Parent 7496 +Directory 3 DefaultDir 4095 +Component 1 Component 11592 +Component 2 ComponentId 7462 +Component 3 Directory_ 3400 +Component 4 Attributes 1282 +Component 5 Condition 7679 +Component 6 KeyPath 7496 +CustomAction 1 Action 11592 +CustomAction 2 Type 1282 +CustomAction 3 Source 7488 +CustomAction 4 Target 7679 +CustomAction 5 ExtendedType 4356 +Error 1 Error 9474 +Error 2 Message 7936 +FeatureComponents 1 Feature_ 11558 +FeatureComponents 2 Component_ 11592 +LaunchCondition 1 Condition 11775 +LaunchCondition 2 Description 4095 +Media 1 DiskId 9474 +Media 2 LastSequence 1282 +Media 3 DiskPrompt 8000 +Media 4 Cabinet 7679 +Media 5 VolumeLabel 7456 +Media 6 Source 7456 +MsiFileHash 1 File_ 11592 +MsiFileHash 2 Options 1282 +MsiFileHash 3 HashPart1 260 +MsiFileHash 4 HashPart2 260 +MsiFileHash 5 HashPart3 260 +MsiFileHash 6 HashPart4 260 +Registry 1 Registry 11592 +Registry 2 Root 1282 +Registry 3 Key 4095 +Registry 4 Name 8191 +Registry 5 Value 7936 +Registry 6 Component_ 3400 +SelfReg 1 File_ 11592 +SelfReg 2 Cost 5378 +Shortcut 1 Shortcut 11592 +Shortcut 2 Directory_ 3400 +Shortcut 3 Name 3968 +Shortcut 4 Component_ 3400 +Shortcut 5 Target 3400 +Shortcut 6 Arguments 7679 +Shortcut 7 Description 8191 +Shortcut 8 Hotkey 5378 +Shortcut 9 Icon_ 7496 +Shortcut 10 IconIndex 5378 +Shortcut 11 ShowCmd 5378 +Shortcut 12 WkDir 7496 +Shortcut 13 DisplayResourceDLL 7524 +Shortcut 14 DisplayResourceId 4356 +Shortcut 15 DescriptionResourceDLL 7524 +Shortcut 16 DescriptionResourceId 4356 +Upgrade 1 UpgradeCode 11558 +Upgrade 2 VersionMin 15636 +Upgrade 3 VersionMax 15636 +Upgrade 4 Language 15871 +Upgrade 5 Attributes 8452 +Upgrade 6 Remove 7679 +Upgrade 7 ActionProperty 3400 +_MAKEMSI_Cabs 1 Name 11568 +_MAKEMSI_Cabs 2 Data 6400 diff --git a/tests/data/icon.txt b/tests/data/icon.txt new file mode 100644 index 0000000..83dcbc8 --- /dev/null +++ b/tests/data/icon.txt @@ -0,0 +1,4 @@ +Name Data +s72 v0 +Icon Name +firefox.16.0.2.0.ico.exe firefox.16.0.2.0.ico.exe diff --git a/tests/data/icon/firefox.16.0.2.0.ico.exe b/tests/data/icon/firefox.16.0.2.0.ico.exe new file mode 100644 index 0000000..ce218a0 Binary files /dev/null and b/tests/data/icon/firefox.16.0.2.0.ico.exe differ diff --git a/tests/data/tables.txt b/tests/data/tables.txt new file mode 100644 index 0000000..1cf9b77 --- /dev/null +++ b/tests/data/tables.txt @@ -0,0 +1,41 @@ +Name +s64 +_Tables +AdminExecuteSequence +AdminUISequence +AdvtExecuteSequence +BBControl +Binary +CheckBox +Property +ComboBox +Control +ActionText +Icon +ListBox +ControlCondition +ControlEvent +Dialog +EventMapping +InstallExecuteSequence +InstallUISequence +ListView +RadioButton +TextStyle +UIText +_Validation +Feature +File +Directory +Component +CustomAction +Error +FeatureComponents +LaunchCondition +Media +MsiFileHash +Registry +SelfReg +Shortcut +Upgrade +_MAKEMSI_Cabs diff --git a/tests/testsuite.at b/tests/testsuite.at index fd18a55..e222d62 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -21,6 +21,31 @@ m4_include([package.m4]) AT_INIT +# AT_MSIDATA - copy data file from source tree + +m4_define([AT_MSIDATA], [ +dir=`dirname $1` +AS_MKDIR_P([$dir]) +AT_CHECK([cp $abs_srcdir/tests/data/$1 $1])]) + +# AT_DATA_UNQUOTED - define data file while allowing shell variables + +m4_define([AT_DATA_UNQUOTED], +[cat >$1 <<_ATEOF +$2[]_ATEOF +]) + +# AT_CR - literal carriage return + +m4_define([AT_CR], [`echo X | tr X '\015'`]) + +# AT_CHECK_MSIBUILD/AT_CHECK_MSIINFO - add exeext automatically +m4_define([AT_CHECK_MSIBUILD], [ +AT_CHECK([_msibuild ]$@)]) + +m4_define([AT_CHECK_MSIINFO], [ +AT_CHECK([_msiinfo ]$@)]) + # Cannot use AT_TESTED because of $EXEEXT (Autotest bug) AT_BANNER([libmsi tests]) @@ -45,3 +70,140 @@ AT_SKIP_IF([! test -f $abs_builddir/tests/testsuminfo$EXEEXT]) AT_CHECK([tests/testsuminfo$EXEEXT], [ignore], [stdout], [ignore]) AT_CHECK([grep ^FAIL stdout], [1], [], []) AT_CLEANUP + +AT_BANNER([msibuild]) + +AT_SETUP([Invalid command line]) +AT_CHECK_MSIBUILD([], [1], [ignore], [ignore]) +AT_CHECK_MSIBUILD([out.msi], [1], [ignore], [ignore]) +AT_CHECK([test -f out.msi], [1]) +AT_CLEANUP + +AT_SETUP([Empty MSI]) +AT_CHECK_MSIBUILD([out.msi -s 'Project name']) +AT_CHECK_MSIINFO([suminfo out.msi], [ignore], [stdout]) +AT_CHECK([grep ^Subject stdout], [0], +[Subject: Project name +]) +AT_CHECK([grep ^Template stdout], [0], +[Template: ;1033 +]) +AT_CHECK([grep ^Version stdout], [0], +[Version: 200 (c8) +]) +AT_CLEANUP + +AT_SETUP([Valid UUID]) +AT_SKIP_IF([test $have_uuid = no]) +AT_CHECK_MSIBUILD([out.msi -s 'Project name']) +AT_CHECK_MSIINFO([suminfo out.msi], [ignore], [stdout]) +AT_CHECK([[ + UUID='\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\}' + grep -E "^Revision number: $UUID\$" stdout]], [0], +[ignore]) +AT_CLEANUP + +AT_SETUP([UUID does not change]) +AT_SKIP_IF([test $have_uuid = no]) +AT_CHECK_MSIBUILD([out.msi -s 'Project name']) +AT_CHECK_MSIINFO([suminfo out.msi | grep ^Revision > expout], [0]) +AT_CHECK_MSIBUILD([out.msi -s 'Project name2']) +AT_CHECK_MSIINFO([suminfo out.msi], [ignore], [stdout]) +AT_CHECK([grep ^Subject stdout], [0], +[Subject: Project name2 +]) +AT_CHECK_MSIINFO([suminfo out.msi | grep ^Revision], [0], [expout]) +AT_CLEANUP + +AT_SETUP([Add stream]) +AT_DATA([test.txt], [This is test.txt +]) +AT_CHECK_MSIBUILD([out.msi -a Binary.testtxt test.txt]) +AT_CHECK_MSIINFO([streams out.msi | grep -v SummaryInformation], [0], +[Binary.testtxt +]) +cp test.txt expout +AT_CHECK_MSIINFO([extract out.msi Binary.testtxt], [0], [expout]) +AT_CLEANUP + +dnl AT_SETUP([Invalid import table]) +dnl AT_XFAIL_IF(:) +dnl AT_DATA([tables.txt], +dnl [Name +dnl s64 +dnl Binary +dnl ]) +dnl AT_CHECK_MSIBUILD([out.msi -i tables.txt]) +dnl AT_CLEANUP + +AT_SETUP([Add tables]) +AT_DATA([tables.txt], +[Name +s64 +_Tables +Binary +]) +AT_CHECK_MSIBUILD([out.msi -i tables.txt]) +AT_CHECK_MSIINFO([tables out.msi], [0], +[Binary +]) +AT_CLEANUP + +AT_SETUP([Add tables and definitions]) +AT_MSIDATA([tables.txt]) +AT_MSIDATA([columns.txt]) +AT_CHECK_MSIBUILD([out.msi -i tables.txt columns.txt]) +AT_DATA_UNQUOTED([expout], +[Name Data[]AT_CR +s72 v0[]AT_CR +Icon Name[]AT_CR +]) +AT_CHECK_MSIINFO([export out.msi Icon], [0], [expout]) +AT_CLEANUP + +AT_SETUP([Separate invocations]) +AT_MSIDATA([tables.txt]) +AT_MSIDATA([columns.txt]) +AT_CHECK_MSIBUILD([out.msi -i tables.txt]) +AT_CHECK_MSIINFO([tables out.msi > expout]) +AT_CHECK_MSIBUILD([out.msi -i columns.txt]) +AT_CHECK_MSIINFO([tables out.msi], [0], [expout]) +AT_CLEANUP + +AT_SETUP([Add table with data]) +AT_MSIDATA([tables.txt]) +AT_MSIDATA([columns.txt]) +AT_MSIDATA([button.txt]) +AT_CHECK_MSIBUILD([out.msi -i tables.txt columns.txt button.txt]) +cp button.txt expout +AT_CHECK_MSIINFO([export out.msi RadioButton], [0], [expout]) +AT_CLEANUP + +AT_SETUP([Add table with streams]) +AT_MSIDATA([tables.txt]) +AT_MSIDATA([columns.txt]) +AT_MSIDATA([icon.txt]) +AT_MSIDATA([icon/firefox.16.0.2.0.ico.exe]) +AT_CHECK_MSIBUILD([out.msi -i tables.txt columns.txt icon.txt]) +cp icon.txt expout +AT_CHECK_MSIINFO([streams out.msi | grep -v SummaryInformation], [0], +[Icon.firefox.16.0.2.0.ico.exe +]) +cp icon/firefox.16.0.2.0.ico.exe expout +AT_CHECK_MSIINFO([extract out.msi Icon.firefox.16.0.2.0.ico.exe > stdout], [0]) +AT_CHECK([cmp stdout expout]) +AT_CLEANUP + +AT_SETUP([Add tables]) +AT_DATA([tables.txt], +[Name +s64 +_Tables +Binary +]) +AT_CHECK_MSIBUILD([-i out.msi tables.txt]) +AT_CHECK_MSIINFO([tables out.msi], [0], +[Binary +]) +AT_CLEANUP + -- cgit