You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(56) |
Apr
(109) |
May
(15) |
Jun
(3) |
Jul
(37) |
Aug
(96) |
Sep
(40) |
Oct
(4) |
Nov
(54) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(47) |
Feb
(30) |
Mar
(102) |
Apr
(120) |
May
(68) |
Jun
(54) |
Jul
(53) |
Aug
(122) |
Sep
(190) |
Oct
(71) |
Nov
(85) |
Dec
(108) |
2007 |
Jan
(72) |
Feb
(190) |
Mar
(53) |
Apr
(101) |
May
(145) |
Jun
(148) |
Jul
(167) |
Aug
(143) |
Sep
(23) |
Oct
(198) |
Nov
(223) |
Dec
(195) |
2008 |
Jan
(100) |
Feb
(129) |
Mar
(79) |
Apr
(77) |
May
(34) |
Jun
(95) |
Jul
(112) |
Aug
(160) |
Sep
(82) |
Oct
(124) |
Nov
(199) |
Dec
(355) |
2009 |
Jan
(436) |
Feb
(89) |
Mar
(298) |
Apr
(189) |
May
(33) |
Jun
(88) |
Jul
(105) |
Aug
(44) |
Sep
(181) |
Oct
(87) |
Nov
(75) |
Dec
(1) |
2010 |
Jan
(63) |
Feb
(21) |
Mar
(3) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(26) |
Aug
(37) |
Sep
(26) |
Oct
(15) |
Nov
(13) |
Dec
|
From: <svn...@op...> - 2009-03-05 14:16:32
|
Author: bellmich Date: Thu Mar 5 15:16:21 2009 New Revision: 193 URL: http://libwbxml.opensync.org/changeset/193 Log: fixed timezone byte handling (e.g. A means UTC+1) Modified: wbxml2/trunk/src/wbxml_parser.c Modified: wbxml2/trunk/src/wbxml_parser.c ============================================================================== --- wbxml2/trunk/src/wbxml_parser.c Thu Mar 5 15:15:34 2009 (r192) +++ wbxml2/trunk/src/wbxml_parser.c Thu Mar 5 15:16:21 2009 (r193) @@ -2797,15 +2797,30 @@ /* Get Time Zone */ if (data_ptr[0] == 0) { + /* This is a bug in the WBXML document. + * If timezone UTC aka Zulu is used then a 'Z' must be set. + */ sprintf((WB_TINY *) result, "%s%s%sT%s%s%sZ", the_year, the_month, the_date, the_hour, the_minute, the_value ? the_second : ""); - } - else { + } else if (data_ptr[0] < 'A' || + data_ptr[0] > 'Z' || + data_ptr[0] == 'J') + { + /* This is a bug in the WBXML document. + * The timezone byte is set and wrong. + * There is no way to recover cleanly from this. + * Therefore no timezone is set. + */ sprintf((WB_TINY *) result, "%s%s%sT%s%s%s", the_year, the_month, the_date, the_hour, the_minute, the_value ? the_second : ""); } + else { + sprintf((WB_TINY *) result, + "%s%s%sT%s%s%s%c", + the_year, the_month, the_date, the_hour, the_minute, the_value ? the_second : "", data_ptr[0]); + } /* Reset buffer */ wbxml_buffer_delete(*data, 0, wbxml_buffer_len(*data)); |
From: <svn...@op...> - 2009-03-05 14:15:40
|
Author: bellmich Date: Thu Mar 5 15:15:34 2009 New Revision: 192 URL: http://libwbxml.opensync.org/changeset/192 Log: added some new test cases for WV datetime Modified: wbxml2/trunk/CMakeLists.txt Modified: wbxml2/trunk/CMakeLists.txt ============================================================================== --- wbxml2/trunk/CMakeLists.txt Thu Mar 5 15:14:52 2009 (r191) +++ wbxml2/trunk/CMakeLists.txt Thu Mar 5 15:15:34 2009 (r192) @@ -243,7 +243,7 @@ SET( si_tests 25 ) SET( sl_tests 13 ) SET( syncml_tests 14 ) -SET( wv_tests 105 ) +SET( wv_tests 116 ) FOREACH( TESTDIR airsync ddf emn ota prov si sl syncml wv ) FOREACH( ITEM RANGE 1 ${${TESTDIR}_tests} ) ADD_TEST( "${TESTDIR}_${ITEM}" launchTests.sh "${CMAKE_SOURCE_DIR}/tests" "${TESTDIR}" ${ITEM} ) |
From: <svn...@op...> - 2009-03-05 14:15:00
|
Author: bellmich Date: Thu Mar 5 15:14:52 2009 New Revision: 191 URL: http://libwbxml.opensync.org/changeset/191 Log: - The normalization code supports now expected conversion values. The example defines that the next text data must be replaced with 1234567890. Please note that case and blanks are strictly required. <!-- EXPECTED ::= 1234567890 --> - Several tests with hexadecimal numbers were fixed. - Some new datetime tests were added because the code is buggy. Added: wbxmlTestSuite/trunk/wv/wv-106-datetime.xml wbxmlTestSuite/trunk/wv/wv-107-datetime.xml wbxmlTestSuite/trunk/wv/wv-108-datetime.xml wbxmlTestSuite/trunk/wv/wv-109-datetime.xml wbxmlTestSuite/trunk/wv/wv-110-datetime.xml wbxmlTestSuite/trunk/wv/wv-111-datetime.xml wbxmlTestSuite/trunk/wv/wv-112-datetime.xml wbxmlTestSuite/trunk/wv/wv-113-datetime.xml wbxmlTestSuite/trunk/wv/wv-114-datetime.xml wbxmlTestSuite/trunk/wv/wv-115-datetime.xml wbxmlTestSuite/trunk/wv/wv-116-datetime.xml Modified: wbxmlTestSuite/trunk/launchTests.sh wbxmlTestSuite/trunk/normalize_xml.pl wbxmlTestSuite/trunk/wv/wv-021.xml wbxmlTestSuite/trunk/wv/wv-022.xml wbxmlTestSuite/trunk/wv/wv-023.xml wbxmlTestSuite/trunk/wv/wv-024.xml Modified: wbxmlTestSuite/trunk/launchTests.sh ============================================================================== --- wbxmlTestSuite/trunk/launchTests.sh Thu Feb 19 18:11:58 2009 (r190) +++ wbxmlTestSuite/trunk/launchTests.sh Thu Mar 5 15:14:52 2009 (r191) @@ -169,11 +169,6 @@ then # SyncML CDATA fix makes comparing sometimes impossible echo CDATA_ENCAPSULATION - else if [ `basename $j` = "wv-021.xml" -o `basename $j` = "wv-022.xml" -o `basename $j` = "wv-023.xml" -o `basename $j` = "wv-024.xml" ] - then - # WV tests which test hexadecimal numbers can only executed - # because libwbxml always outputs decimal numbers - echo HEX_CONVERSION else $PERL_BIN $NORMALIZE_SCRIPT --delete-attribute xmlns $j $OUT_XML.org $PERL_BIN $NORMALIZE_SCRIPT --delete-attribute xmlns $OUT_XML $OUT_XML.new @@ -185,7 +180,7 @@ else echo SUCCEEDED fi - fi fi fi + fi fi done fi Modified: wbxmlTestSuite/trunk/normalize_xml.pl ============================================================================== --- wbxmlTestSuite/trunk/normalize_xml.pl Thu Feb 19 18:11:58 2009 (r190) +++ wbxmlTestSuite/trunk/normalize_xml.pl Thu Mar 5 15:14:52 2009 (r191) @@ -123,6 +123,7 @@ my $char = ""; my $text = ""; my $element = ""; +my $expected = ""; $state = "NEUTRAL"; while (1) { ## $line works line oriented @@ -149,6 +150,11 @@ # handle comment or element which starts in a text line if ($state eq "TEXT" and $char eq "<") { + if (length($expected)) { + # the original text must be replaced for test validation + $text = $expected; + $expected = ""; + } $text =~ s{\s*$}{}; print $NEW_FD "${text}\n"; $state = "NEUTRAL"; @@ -167,6 +173,7 @@ $char = substr($line, 0, 2); $line = substr($line, 2); $state = "COMMENT"; + $text = ""; } elsif ($line =~ q{^\[CDATA\[}) { ## CDATA section detected for (my $i = 0; $i < $indent; $i++) { @@ -209,7 +216,16 @@ # end of comment $line = substr($line, 2); $state = "NEUTRAL"; - } + # check if this is a special action configuration + if ($text =~ m{^\sEXPECTED\s::=\s.*\s$}) { + # This is the value for the next text data. + $expected = $text; + $expected =~ s{^\sEXPECTED\s::=\s(.*)\s$}{$1}; + $text = ""; + } + } else { + $text .= $char; + } next; } Modified: wbxmlTestSuite/trunk/wv/wv-021.xml ============================================================================== --- wbxmlTestSuite/trunk/wv/wv-021.xml Thu Feb 19 18:11:58 2009 (r190) +++ wbxmlTestSuite/trunk/wv/wv-021.xml Thu Mar 5 15:14:52 2009 (r191) @@ -19,6 +19,7 @@ <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> <Search-Response> + <!-- EXPECTED ::= 595760001 --> <SearchID>0x23829381</SearchID> <SearchFindings>7</SearchFindings> Modified: wbxmlTestSuite/trunk/wv/wv-022.xml ============================================================================== --- wbxmlTestSuite/trunk/wv/wv-022.xml Thu Feb 19 18:11:58 2009 (r190) +++ wbxmlTestSuite/trunk/wv/wv-022.xml Thu Mar 5 15:14:52 2009 (r191) @@ -17,6 +17,7 @@ <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> <Search-Request> + <!-- EXPECTED ::= 595760001 --> <SearchID>0x23829381</SearchID> <SearchIndex>6</SearchIndex> Modified: wbxmlTestSuite/trunk/wv/wv-023.xml ============================================================================== --- wbxmlTestSuite/trunk/wv/wv-023.xml Thu Feb 19 18:11:58 2009 (r190) +++ wbxmlTestSuite/trunk/wv/wv-023.xml Thu Mar 5 15:14:52 2009 (r191) @@ -19,6 +19,7 @@ <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> <Search-Response> + <!-- EXPECTED ::= 595760001 --> <SearchID>0x23829381</SearchID> <SearchFindings>7</SearchFindings> Modified: wbxmlTestSuite/trunk/wv/wv-024.xml ============================================================================== --- wbxmlTestSuite/trunk/wv/wv-024.xml Thu Feb 19 18:11:58 2009 (r190) +++ wbxmlTestSuite/trunk/wv/wv-024.xml Thu Mar 5 15:14:52 2009 (r191) @@ -17,6 +17,7 @@ <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> <StopSearch-Request> + <!-- EXPECTED ::= 595760001 --> <SearchID>0x23829381</SearchID> </StopSearch-Request> </TransactionContent> Added: wbxmlTestSuite/trunk/wv/wv-106-datetime.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ wbxmlTestSuite/trunk/wv/wv-106-datetime.xml Thu Mar 5 15:14:52 2009 (r191) @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<!DOCTYPE WV-CSP-Message PUBLIC "-//OMA//DTD WV-CSP 1.1//EN" "http://www.openmobilealliance.org/DTD/WV-CSP.XML"> +<WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1"> + <Session> + <SessionDescriptor> + <SessionType>Inband</SessionType> + + <SessionID>im.user.com#48...@se...</SessionID> + </SessionDescriptor> + + <Transaction> + <TransactionDescriptor> + <TransactionMode>Request</TransactionMode> + + <TransactionID>IMApp01#12345@NOK5110</TransactionID> + + <Poll>F</Poll> + </TransactionDescriptor> + + <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> + <MessageNotification> + <MessageInfo> + <MessageID>0x0000f132</MessageID> + + <ContentType>text/plain</ContentType> + + <ContentEncoding>None</ContentEncoding> + + <ContentSize>189</ContentSize> + + <Recipient> + <Group> + <ScreenName> + <SName>Johnnie</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Recipient> + + <Sender> + <Group> + <ScreenName> + <SName>Wicked Vicky</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Sender> + + <!-- datetime format test + - without seconds + - without timezone + - without any number seperators + --> + <!-- EXPECTED ::= 20010925T1340Z --> + <DateTime>20010925T1340</DateTime> + + <Validity>600</Validity> + </MessageInfo> + </MessageNotification> + </TransactionContent> + </Transaction> + </Session> +</WV-CSP-Message> + Added: wbxmlTestSuite/trunk/wv/wv-107-datetime.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ wbxmlTestSuite/trunk/wv/wv-107-datetime.xml Thu Mar 5 15:14:52 2009 (r191) @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<!DOCTYPE WV-CSP-Message PUBLIC "-//OMA//DTD WV-CSP 1.1//EN" "http://www.openmobilealliance.org/DTD/WV-CSP.XML"> +<WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1"> + <Session> + <SessionDescriptor> + <SessionType>Inband</SessionType> + + <SessionID>im.user.com#48...@se...</SessionID> + </SessionDescriptor> + + <Transaction> + <TransactionDescriptor> + <TransactionMode>Request</TransactionMode> + + <TransactionID>IMApp01#12345@NOK5110</TransactionID> + + <Poll>F</Poll> + </TransactionDescriptor> + + <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> + <MessageNotification> + <MessageInfo> + <MessageID>0x0000f132</MessageID> + + <ContentType>text/plain</ContentType> + + <ContentEncoding>None</ContentEncoding> + + <ContentSize>189</ContentSize> + + <Recipient> + <Group> + <ScreenName> + <SName>Johnnie</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Recipient> + + <Sender> + <Group> + <ScreenName> + <SName>Wicked Vicky</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Sender> + + <!-- datetime format test + - with seconds + - without timezone + - without any number seperators + --> + <!-- EXPECTED ::= 20010925T134013Z --> + <DateTime>20010925T134013</DateTime> + + <Validity>600</Validity> + </MessageInfo> + </MessageNotification> + </TransactionContent> + </Transaction> + </Session> +</WV-CSP-Message> + Added: wbxmlTestSuite/trunk/wv/wv-108-datetime.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ wbxmlTestSuite/trunk/wv/wv-108-datetime.xml Thu Mar 5 15:14:52 2009 (r191) @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<!DOCTYPE WV-CSP-Message PUBLIC "-//OMA//DTD WV-CSP 1.1//EN" "http://www.openmobilealliance.org/DTD/WV-CSP.XML"> +<WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1"> + <Session> + <SessionDescriptor> + <SessionType>Inband</SessionType> + + <SessionID>im.user.com#48...@se...</SessionID> + </SessionDescriptor> + + <Transaction> + <TransactionDescriptor> + <TransactionMode>Request</TransactionMode> + + <TransactionID>IMApp01#12345@NOK5110</TransactionID> + + <Poll>F</Poll> + </TransactionDescriptor> + + <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> + <MessageNotification> + <MessageInfo> + <MessageID>0x0000f132</MessageID> + + <ContentType>text/plain</ContentType> + + <ContentEncoding>None</ContentEncoding> + + <ContentSize>189</ContentSize> + + <Recipient> + <Group> + <ScreenName> + <SName>Johnnie</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Recipient> + + <Sender> + <Group> + <ScreenName> + <SName>Wicked Vicky</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Sender> + + <!-- datetime format test + - without seconds + - with timezone + - without any number seperators + --> + <DateTime>20010925T1340Z</DateTime> + + <Validity>600</Validity> + </MessageInfo> + </MessageNotification> + </TransactionContent> + </Transaction> + </Session> +</WV-CSP-Message> + Added: wbxmlTestSuite/trunk/wv/wv-109-datetime.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ wbxmlTestSuite/trunk/wv/wv-109-datetime.xml Thu Mar 5 15:14:52 2009 (r191) @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<!DOCTYPE WV-CSP-Message PUBLIC "-//OMA//DTD WV-CSP 1.1//EN" "http://www.openmobilealliance.org/DTD/WV-CSP.XML"> +<WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1"> + <Session> + <SessionDescriptor> + <SessionType>Inband</SessionType> + + <SessionID>im.user.com#48...@se...</SessionID> + </SessionDescriptor> + + <Transaction> + <TransactionDescriptor> + <TransactionMode>Request</TransactionMode> + + <TransactionID>IMApp01#12345@NOK5110</TransactionID> + + <Poll>F</Poll> + </TransactionDescriptor> + + <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> + <MessageNotification> + <MessageInfo> + <MessageID>0x0000f132</MessageID> + + <ContentType>text/plain</ContentType> + + <ContentEncoding>None</ContentEncoding> + + <ContentSize>189</ContentSize> + + <Recipient> + <Group> + <ScreenName> + <SName>Johnnie</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Recipient> + + <Sender> + <Group> + <ScreenName> + <SName>Wicked Vicky</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Sender> + + <!-- datetime format test + - with seconds + - with timezone + - without any number seperators + --> + <DateTime>20010925T134013Z</DateTime> + + <Validity>600</Validity> + </MessageInfo> + </MessageNotification> + </TransactionContent> + </Transaction> + </Session> +</WV-CSP-Message> + Added: wbxmlTestSuite/trunk/wv/wv-110-datetime.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ wbxmlTestSuite/trunk/wv/wv-110-datetime.xml Thu Mar 5 15:14:52 2009 (r191) @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<!DOCTYPE WV-CSP-Message PUBLIC "-//OMA//DTD WV-CSP 1.1//EN" "http://www.openmobilealliance.org/DTD/WV-CSP.XML"> +<WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1"> + <Session> + <SessionDescriptor> + <SessionType>Inband</SessionType> + + <SessionID>im.user.com#48...@se...</SessionID> + </SessionDescriptor> + + <Transaction> + <TransactionDescriptor> + <TransactionMode>Request</TransactionMode> + + <TransactionID>IMApp01#12345@NOK5110</TransactionID> + + <Poll>F</Poll> + </TransactionDescriptor> + + <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> + <MessageNotification> + <MessageInfo> + <MessageID>0x0000f132</MessageID> + + <ContentType>text/plain</ContentType> + + <ContentEncoding>None</ContentEncoding> + + <ContentSize>189</ContentSize> + + <Recipient> + <Group> + <ScreenName> + <SName>Johnnie</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Recipient> + + <Sender> + <Group> + <ScreenName> + <SName>Wicked Vicky</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Sender> + + <!-- datetime format test + - with seconds + - with timezone + - with number seperators + --> + <DateTime>2001-09-25T13:40:13Z</DateTime> + + <Validity>600</Validity> + </MessageInfo> + </MessageNotification> + </TransactionContent> + </Transaction> + </Session> +</WV-CSP-Message> + Added: wbxmlTestSuite/trunk/wv/wv-111-datetime.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ wbxmlTestSuite/trunk/wv/wv-111-datetime.xml Thu Mar 5 15:14:52 2009 (r191) @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<!DOCTYPE WV-CSP-Message PUBLIC "-//OMA//DTD WV-CSP 1.1//EN" "http://www.openmobilealliance.org/DTD/WV-CSP.XML"> +<WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1"> + <Session> + <SessionDescriptor> + <SessionType>Inband</SessionType> + + <SessionID>im.user.com#48...@se...</SessionID> + </SessionDescriptor> + + <Transaction> + <TransactionDescriptor> + <TransactionMode>Request</TransactionMode> + + <TransactionID>IMApp01#12345@NOK5110</TransactionID> + + <Poll>F</Poll> + </TransactionDescriptor> + + <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> + <MessageNotification> + <MessageInfo> + <MessageID>0x0000f132</MessageID> + + <ContentType>text/plain</ContentType> + + <ContentEncoding>None</ContentEncoding> + + <ContentSize>189</ContentSize> + + <Recipient> + <Group> + <ScreenName> + <SName>Johnnie</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Recipient> + + <Sender> + <Group> + <ScreenName> + <SName>Wicked Vicky</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Sender> + + <!-- datetime format test + - with seconds + - with timezone + - with number seperators + - with timezone of Germany + --> + <DateTime>2001-09-25T13:40:13A</DateTime> + + <Validity>600</Validity> + </MessageInfo> + </MessageNotification> + </TransactionContent> + </Transaction> + </Session> +</WV-CSP-Message> + Added: wbxmlTestSuite/trunk/wv/wv-112-datetime.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ wbxmlTestSuite/trunk/wv/wv-112-datetime.xml Thu Mar 5 15:14:52 2009 (r191) @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<!DOCTYPE WV-CSP-Message PUBLIC "-//OMA//DTD WV-CSP 1.1//EN" "http://www.openmobilealliance.org/DTD/WV-CSP.XML"> +<WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1"> + <Session> + <SessionDescriptor> + <SessionType>Inband</SessionType> + + <SessionID>im.user.com#48...@se...</SessionID> + </SessionDescriptor> + + <Transaction> + <TransactionDescriptor> + <TransactionMode>Request</TransactionMode> + + <TransactionID>IMApp01#12345@NOK5110</TransactionID> + + <Poll>F</Poll> + </TransactionDescriptor> + + <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> + <MessageNotification> + <MessageInfo> + <MessageID>0x0000f132</MessageID> + + <ContentType>text/plain</ContentType> + + <ContentEncoding>None</ContentEncoding> + + <ContentSize>189</ContentSize> + + <Recipient> + <Group> + <ScreenName> + <SName>Johnnie</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Recipient> + + <Sender> + <Group> + <ScreenName> + <SName>Wicked Vicky</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Sender> + + <!-- datetime format test + - with seconds + - with timezone + - with number seperators + - with timezone of Germany + --> + <DateTime>2001-09-25T13:40:13+01:00</DateTime> + + <Validity>600</Validity> + </MessageInfo> + </MessageNotification> + </TransactionContent> + </Transaction> + </Session> +</WV-CSP-Message> + Added: wbxmlTestSuite/trunk/wv/wv-113-datetime.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ wbxmlTestSuite/trunk/wv/wv-113-datetime.xml Thu Mar 5 15:14:52 2009 (r191) @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<!DOCTYPE WV-CSP-Message PUBLIC "-//OMA//DTD WV-CSP 1.1//EN" "http://www.openmobilealliance.org/DTD/WV-CSP.XML"> +<WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1"> + <Session> + <SessionDescriptor> + <SessionType>Inband</SessionType> + + <SessionID>im.user.com#48...@se...</SessionID> + </SessionDescriptor> + + <Transaction> + <TransactionDescriptor> + <TransactionMode>Request</TransactionMode> + + <TransactionID>IMApp01#12345@NOK5110</TransactionID> + + <Poll>F</Poll> + </TransactionDescriptor> + + <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> + <MessageNotification> + <MessageInfo> + <MessageID>0x0000f132</MessageID> + + <ContentType>text/plain</ContentType> + + <ContentEncoding>None</ContentEncoding> + + <ContentSize>189</ContentSize> + + <Recipient> + <Group> + <ScreenName> + <SName>Johnnie</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Recipient> + + <Sender> + <Group> + <ScreenName> + <SName>Wicked Vicky</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Sender> + + <!-- datetime format test + - with seconds + - with timezone + - with number seperators + - with timezone of Germany + --> + <DateTime>2001-09-25T13:40:13+0100</DateTime> + + <Validity>600</Validity> + </MessageInfo> + </MessageNotification> + </TransactionContent> + </Transaction> + </Session> +</WV-CSP-Message> + Added: wbxmlTestSuite/trunk/wv/wv-114-datetime.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ wbxmlTestSuite/trunk/wv/wv-114-datetime.xml Thu Mar 5 15:14:52 2009 (r191) @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<!DOCTYPE WV-CSP-Message PUBLIC "-//OMA//DTD WV-CSP 1.1//EN" "http://www.openmobilealliance.org/DTD/WV-CSP.XML"> +<WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1"> + <Session> + <SessionDescriptor> + <SessionType>Inband</SessionType> + + <SessionID>im.user.com#48...@se...</SessionID> + </SessionDescriptor> + + <Transaction> + <TransactionDescriptor> + <TransactionMode>Request</TransactionMode> + + <TransactionID>IMApp01#12345@NOK5110</TransactionID> + + <Poll>F</Poll> + </TransactionDescriptor> + + <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> + <MessageNotification> + <MessageInfo> + <MessageID>0x0000f132</MessageID> + + <ContentType>text/plain</ContentType> + + <ContentEncoding>None</ContentEncoding> + + <ContentSize>189</ContentSize> + + <Recipient> + <Group> + <ScreenName> + <SName>Johnnie</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Recipient> + + <Sender> + <Group> + <ScreenName> + <SName>Wicked Vicky</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Sender> + + <!-- datetime format test + - with seconds + - with timezone + - with number seperators + - with timezone of Germany + --> + <DateTime>2001-09-25T13:40:13+01</DateTime> + + <Validity>600</Validity> + </MessageInfo> + </MessageNotification> + </TransactionContent> + </Transaction> + </Session> +</WV-CSP-Message> + Added: wbxmlTestSuite/trunk/wv/wv-115-datetime.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ wbxmlTestSuite/trunk/wv/wv-115-datetime.xml Thu Mar 5 15:14:52 2009 (r191) @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<!DOCTYPE WV-CSP-Message PUBLIC "-//OMA//DTD WV-CSP 1.1//EN" "http://www.openmobilealliance.org/DTD/WV-CSP.XML"> +<WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1"> + <Session> + <SessionDescriptor> + <SessionType>Inband</SessionType> + + <SessionID>im.user.com#48...@se...</SessionID> + </SessionDescriptor> + + <Transaction> + <TransactionDescriptor> + <TransactionMode>Request</TransactionMode> + + <TransactionID>IMApp01#12345@NOK5110</TransactionID> + + <Poll>F</Poll> + </TransactionDescriptor> + + <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> + <MessageNotification> + <MessageInfo> + <MessageID>0x0000f132</MessageID> + + <ContentType>text/plain</ContentType> + + <ContentEncoding>None</ContentEncoding> + + <ContentSize>189</ContentSize> + + <Recipient> + <Group> + <ScreenName> + <SName>Johnnie</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Recipient> + + <Sender> + <Group> + <ScreenName> + <SName>Wicked Vicky</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Sender> + + <!-- datetime format test + - with seconds + - with timezone + - with number seperators + - with timezone of Germany + --> + <DateTime>2001-09-25T13:40:13+1</DateTime> + + <Validity>600</Validity> + </MessageInfo> + </MessageNotification> + </TransactionContent> + </Transaction> + </Session> +</WV-CSP-Message> + Added: wbxmlTestSuite/trunk/wv/wv-116-datetime.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ wbxmlTestSuite/trunk/wv/wv-116-datetime.xml Thu Mar 5 15:14:52 2009 (r191) @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<!DOCTYPE WV-CSP-Message PUBLIC "-//OMA//DTD WV-CSP 1.1//EN" "http://www.openmobilealliance.org/DTD/WV-CSP.XML"> +<WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1"> + <Session> + <SessionDescriptor> + <SessionType>Inband</SessionType> + + <SessionID>im.user.com#48...@se...</SessionID> + </SessionDescriptor> + + <Transaction> + <TransactionDescriptor> + <TransactionMode>Request</TransactionMode> + + <TransactionID>IMApp01#12345@NOK5110</TransactionID> + + <Poll>F</Poll> + </TransactionDescriptor> + + <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1"> + <MessageNotification> + <MessageInfo> + <MessageID>0x0000f132</MessageID> + + <ContentType>text/plain</ContentType> + + <ContentEncoding>None</ContentEncoding> + + <ContentSize>189</ContentSize> + + <Recipient> + <Group> + <ScreenName> + <SName>Johnnie</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Recipient> + + <Sender> + <Group> + <ScreenName> + <SName>Wicked Vicky</SName> + + <GroupID>wv:john/cha...@th...</GroupID> + </ScreenName> + </Group> + </Sender> + + <!-- datetime format test + - with seconds + - with timezone + - with number seperators + - with timezone of New York + --> + <DateTime>2001-09-25T13:40:13-05:00</DateTime> + + <Validity>600</Validity> + </MessageInfo> + </MessageNotification> + </TransactionContent> + </Transaction> + </Session> +</WV-CSP-Message> + |
From: <svn...@op...> - 2009-03-03 17:07:36
|
Author: bellmich Date: Tue Mar 3 18:07:33 2009 New Revision: 965 URL: http://libsyncml.opensync.org/changeset/965 Log: added automatic channel discovery for OBEX client transport on Linux - fixed inclusion of CheckFunctionExists - fixed all OBEX related option handling - added option ENABLE_BLUETOOTH_SDPLIB - added code to search for a SyncML client on a known Bluetooth device Modified: trunk/CMakeLists.txt trunk/config.h.cmake trunk/libsyncml/transports/obex_client.c Modified: trunk/CMakeLists.txt ============================================================================== --- trunk/CMakeLists.txt Mon Mar 2 16:39:57 2009 (r964) +++ trunk/CMakeLists.txt Tue Mar 3 18:07:33 2009 (r965) @@ -53,6 +53,7 @@ # find header files and type size INCLUDE( CheckTypeSize ) INCLUDE( CheckIncludeFiles ) +INCLUDE( CheckFunctionExists ) INCLUDE( Documentation ) INCLUDE( AddDocumentation ) @@ -103,7 +104,6 @@ SET ( FATAL_ERROR_GLIB2 "Cannot find correct glib version ${GLIB2_MIN_VERSION}." ) SET ( ENABLE_GLIB2_GREGEX ON ) ELSE ( NOT GLIB2_FOUND ) - INCLUDE(CheckFunctionExists) SET( CMAKE_REQUIRED_INCLUDES ${GLIB2_INCLUDE_DIRS} ) SET( CMAKE_REQUIRED_LIBRARIES ${GLIB2_LIBRARIES} ) CHECK_FUNCTION_EXISTS( g_regex_new GLIB2_HAVE_GREGEX ) @@ -131,21 +131,33 @@ SET( ENABLE_HTTP OFF ) ENDIF(LIBSOUP2_FOUND) -OPTION( ENABLE_OBEX "enable obex transports" OFF ) -OPTION( ENABLE_OPENOBEX_TCP "enable OBEX transport via TCP (requires OpenOBEX 1.3+SVN" OFF ) IF(OPENOBEX_FOUND) - SET( ENABLE_OBEX ON ) + OPTION( ENABLE_OBEX "enable obex transports" ON ) IF(BLUEZ_FOUND) OPTION( ENABLE_BLUETOOTH "enable obex over bluetooth transports" ON ) + SET( CMAKE_REQUIRED_FLAGS ${BLUEZ_CFLAGS} ) + SET( CMAKE_REQUIRED_INCLUDES ${BLUEZ_INCLUDE_DIRS} ) + SET( CMAKE_REQUIRED_LIBRARIES ${BLUEZ_LIBRARIES} ) + CHECK_FUNCTION_EXISTS( sdp_service_search_attr_req BLUETOOTH_SDPLIB ) + IF( BLUETOOTH_SDPLIB ) + OPTION( ENABLE_BLUETOOTH_SDPLIB "enable bluetooth channel discovery" ON ) + ENDIF( BLUETOOTH_SDPLIB ) ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") OPTION( ENABLE_BLUETOOTH "enable obex over bluetooth transports" ON ) LINK_LIBRARIES(bluetooth sdp) ELSE(BLUEZ_FOUND) - SET( ENABLE_BLUETOOTH OFF ) + OPTION( ENABLE_BLUETOOTH "enable obex over bluetooth transports" OFF ) ENDIF(BLUEZ_FOUND) IF( OPENOBEX_HAVE_TCPOBEX ) - SET( ENABLE_OPENOBEX_TCP ON ) + OPTION( ENABLE_OPENOBEX_TCP "enable obex over bluetooth transports" ON ) + ELSE( OPENOBEX_HAVE_TCPOBEX ) + OPTION( ENABLE_OPENOBEX_TCP "enable OBEX transport via TCP (requires OpenOBEX 1.3+SVN)" OFF ) ENDIF( OPENOBEX_HAVE_TCPOBEX ) +ELSE(OPENOBEX_FOUND) + OPTION( ENABLE_OBEX "enable obex transports" OFF ) + OPTION( ENABLE_OPENOBEX_TCP "enable OBEX transport via TCP (requires OpenOBEX 1.3+SVN)" OFF ) + OPTION( ENABLE_BLUETOOTH "enable obex over bluetooth transports" OFF ) + OPTION( ENABLE_BLUETOOTH_SDPLIB "enable bluetooth channel discovery" OFF ) ENDIF(OPENOBEX_FOUND) IF( NOT LIBSOUP2_FOUND AND NOT OPENOBEX_FOUND ) @@ -232,7 +244,8 @@ SHOW_STATUS( ENABLE_WBXML "WAP Binary XML\t\t" LIBWBXML2_VERSION ) SHOW_STATUS( ENABLE_HTTP "http transports\t\t" LIBSOUP2_VERSION ) SHOW_STATUS( ENABLE_OBEX "obex transports\t\t" OPENOBEX_VERSION ) -SHOW_STATUS( ENABLE_BLUETOOTH "obex over bluetooth transports" ) +SHOW_STATUS( ENABLE_BLUETOOTH "obex over bluetooth transports" BLUEZ_VERSION ) +SHOW_STATUS( ENABLE_BLUETOOTH_SDPLIB "bluetooth channel discovery\t" ) SHOW_STATUS( ENABLE_OPENOBEX_TCP "obex over tcp transports\t" ) SHOW_STATUS( ENABLE_BASE64_TEST "deprecated base64 tests\t" ) SHOW_STATUS( ENABLE_GLIB2_GREGEX "glib2 GRegex support\t\t" GLIB2_VERSION ) Modified: trunk/config.h.cmake ============================================================================== --- trunk/config.h.cmake Mon Mar 2 16:39:57 2009 (r964) +++ trunk/config.h.cmake Tue Mar 3 18:07:33 2009 (r965) @@ -3,6 +3,9 @@ /* Bluetooth Transport */ #cmakedefine ENABLE_BLUETOOTH +/* Bluetooth SDP library - necessary for automatic channel discovery */ +#cmakedefine ENABLE_BLUETOOTH_SDPLIB + /* Http Transport */ #cmakedefine ENABLE_HTTP Modified: trunk/libsyncml/transports/obex_client.c ============================================================================== --- trunk/libsyncml/transports/obex_client.c Mon Mar 2 16:39:57 2009 (r964) +++ trunk/libsyncml/transports/obex_client.c Tue Mar 3 18:07:33 2009 (r965) @@ -29,6 +29,13 @@ #include "obex_client_internals.h" #include "obex_client_vendor_internals.h" +#ifdef ENABLE_BLUETOOTH_SDPLIB + +#include <bluetooth/sdp.h> +#include <bluetooth/sdp_lib.h> + +#endif + #include <fcntl.h> #include <sys/poll.h> #include <sys/stat.h> @@ -756,11 +763,13 @@ "The bluetooth address is missing."); goto error; } +#ifndef ENABLE_BLUETOOTH_SDPLIB if (!env->port) { smlErrorSet(error, SML_ERROR_GENERIC, "The bluetooth channel is missing."); goto error; } +#endif break; default: /* nothing to check here */ @@ -888,6 +897,59 @@ bdaddr_t bdaddr; str2ba(env->path, &bdaddr); +#ifdef ENABLE_BLUETOOTH_SDPLIB + if (channel == 0) { + /* FIXME: Is this code really memory leak free !? */ + + sdp_session_t *sdp_session = sdp_connect(BDADDR_ANY, &bdaddr, SDP_RETRY_IF_BUSY); + if (!sdp_session) { + smlErrorSet(&error, SML_ERROR_GENERIC, "The Bluetooth connect to search for the channel failed."); + goto error; + } + unsigned char syncml_client_uuid[] = { + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x10, 0x00, + 0x80, 0x00, 0x00, 0x02, 0xEE, 0x00, 0x00, 0x02}; + uuid_t uuid; + uint32_t range = SDP_ATTR_PROTO_DESC_LIST; + sdp_uuid128_create(&uuid, syncml_client_uuid); + sdp_list_t *attribute = sdp_list_append(0, &range); + sdp_list_t *class = sdp_list_append(0, &uuid); + + sdp_list_t *list; + if (sdp_service_search_attr_req(sdp_session, class, SDP_ATTR_REQ_INDIVIDUAL, attribute, &list) < 0) { + sdp_close(sdp_session); + sdp_list_free(attribute, 0); + sdp_list_free(class, 0); + + smlErrorSet( + &error, SML_ERROR_GENERIC, + "The service search on the Bluetooth device failed."); + goto error; + } + sdp_list_free(attribute, 0); + sdp_list_free(class, 0); + + sdp_list_t *iterator; + for(iterator = list; iterator; iterator = iterator->next) { + sdp_record_t *item = (sdp_record_t *) iterator->data; + sdp_list_t *protos = NULL; + + sdp_get_access_protos(item, &protos); + if(protos) { + channel = sdp_get_proto_port(protos, RFCOMM_UUID); + } + sdp_record_free(item); + } + sdp_list_free(list, 0); + sdp_close(sdp_session); + sleep(1); + smlTrace(TRACE_INTERNAL, + "%s: SDP SyncML channel for %s: %d", + __func__, env->path, channel); + + } +#endif + if (GET_OBEX_RESULT(BtOBEX_TransportConnect(env->obexhandle, BDADDR_ANY, &bdaddr, channel)) < 0) { smlErrorSet(&error, SML_ERROR_GENERIC, "The Bluetooth connect failed. %s (%i).", |
From: <svn...@op...> - 2009-03-02 15:40:02
|
Author: bellmich Date: Mon Mar 2 16:39:57 2009 New Revision: 964 URL: http://libsyncml.opensync.org/changeset/964 Log: If the lock is created to early then the called function of expr can potentially use a callback which calls sml_fail_unless too. The result is a deadlock because the called function expr waits for the lock which is already reserved. expr has not to be a function but it can be a function. Modified: trunk/tests/support.h Modified: trunk/tests/support.h ============================================================================== --- trunk/tests/support.h Mon Mar 2 15:50:50 2009 (r963) +++ trunk/tests/support.h Mon Mar 2 16:39:57 2009 (r964) @@ -46,8 +46,8 @@ #define sml_fail_unless(expr, ...);\ {\ - g_static_mutex_lock(&__libsyncml_check_mutex);\ int _result = expr;\ + g_static_mutex_lock(&__libsyncml_check_mutex);\ fail_unless(_result, ## __VA_ARGS__);\ if (!_result) smlAssertMsg(0, g_strdup_printf(__VA_ARGS__));\ g_static_mutex_unlock(&__libsyncml_check_mutex);\ |
From: <svn...@op...> - 2009-03-02 14:50:55
|
Author: bellmich Date: Mon Mar 2 15:50:50 2009 New Revision: 963 URL: http://libsyncml.opensync.org/changeset/963 Log: sanitized some sml_fail_unless calls (sml_fail_unless requires some more careful block handling than fail) Modified: trunk/tests/check_data_sync_api.c trunk/tests/mobiles/obex_mobile_ds_client.c trunk/tests/support.c Modified: trunk/tests/check_data_sync_api.c ============================================================================== --- trunk/tests/check_data_sync_api.c Mon Mar 2 15:30:56 2009 (r962) +++ trunk/tests/check_data_sync_api.c Mon Mar 2 15:50:50 2009 (r963) @@ -63,8 +63,9 @@ const char *test_data = list->data; char *name = g_strdup_printf("%d", count); if (!smlDataSyncAddChange(client, client_source, SML_CHANGE_ADD, - name , test_data, strlen(test_data), NULL, error)) + name , test_data, strlen(test_data), NULL, error)) { sml_fail_unless(FALSE, "%s", smlErrorPrint(error)); + } smlSafeCFree(&name); } } @@ -151,13 +152,15 @@ /* clients should never receive a change in this test */ - if (dsObject == client) + if (dsObject == client) { sml_fail_unless(FALSE, "A change was received from the server."); + } /* check the source */ - if (strcmp(server_source, source)) + if (strcmp(server_source, source)) { sml_fail_unless(FALSE, "The source %s is wrong.", server_source); + } /* handle the item */ GList *list = client_items; @@ -174,8 +177,9 @@ smlSafeCFree(&name); /* item with correct uid */ - if (strcmp(list->data, data)) + if (strcmp(list->data, data)) { sml_fail_unless(FALSE, "The data of the item %s was wrong(%s != %s).", uid, data, list->data); + } } smlSafeCFree(&data); Modified: trunk/tests/mobiles/obex_mobile_ds_client.c ============================================================================== --- trunk/tests/mobiles/obex_mobile_ds_client.c Mon Mar 2 15:30:56 2009 (r962) +++ trunk/tests/mobiles/obex_mobile_ds_client.c Mon Mar 2 15:50:50 2009 (r963) @@ -266,8 +266,9 @@ if (!equal_messages( data->data, data->size, libsyncml_msg_notification_data, - libsyncml_msg_notification_size)) + libsyncml_msg_notification_size)) { sml_fail_unless(FALSE, "wrong notification message"); + } mobile_state = TEST_MOBILE_STATE_WAIT_FOR_ALERT; obex_mobile_send(link, mobile_msg_alert_data, mobile_msg_alert_size); } else if (mobile_state == TEST_MOBILE_STATE_WAIT_FOR_ALERT) { @@ -275,8 +276,9 @@ if (!equal_messages( data->data, data->size, libsyncml_msg_alert_data, - libsyncml_msg_alert_size)) + libsyncml_msg_alert_size)) { sml_fail_unless(FALSE, "wrong alert message"); + } mobile_state = TEST_MOBILE_STATE_WAIT_FOR_SYNC; obex_mobile_send(link, mobile_msg_sync_data, mobile_msg_sync_size); } else if (mobile_state == TEST_MOBILE_STATE_WAIT_FOR_SYNC) { @@ -284,8 +286,9 @@ if (!equal_messages( data->data, data->size, libsyncml_msg_sync_data, - libsyncml_msg_sync_size)) + libsyncml_msg_sync_size)) { sml_fail_unless(FALSE, "wrong sync message"); + } mobile_state = TEST_MOBILE_STATE_WAIT_FOR_END; obex_mobile_send(link, mobile_msg_map_data, mobile_msg_map_size); } else if (mobile_state == TEST_MOBILE_STATE_WAIT_FOR_END) { @@ -293,8 +296,9 @@ if (!equal_messages( data->data, data->size, libsyncml_msg_end_data, - libsyncml_msg_end_size)) + libsyncml_msg_end_size)) { sml_fail_unless(FALSE, "wrong end message"); + } mobile_state = TEST_MOBILE_STATE_FINISHED; /* The disconnect must be issued by obex client * but the mobile is the OBEX server. Modified: trunk/tests/support.c ============================================================================== --- trunk/tests/support.c Mon Mar 2 15:30:56 2009 (r962) +++ trunk/tests/support.c Mon Mar 2 15:50:50 2009 (r963) @@ -87,19 +87,19 @@ if (fkt_name) { testbed = g_strdup_printf("%s/testbed.XXXXXX", g_get_tmp_dir()); if (mkdtemp(testbed)) - fail("Cannot setup testbed at %s.", testbed); + sml_fail_unless(FALSE, "Cannot setup testbed at %s.", testbed); char *command = NULL; if (fkt_name) { command = g_strdup_printf("cp -R %s%sdata/%s/* %s", g_getenv("srcdir") ? g_getenv("srcdir") : "", g_getenv("srcdir") ? "/" : "", fkt_name, testbed); if (system(command)) - fail("Cannot execute command \"%s\".", command); + sml_fail_unless(FALSE, "Cannot execute command \"%s\".", command); g_free(command); } olddir = g_get_current_dir(); if (chdir(testbed)) - fail("Cannot change to testbed directory %s.", testbed); + sml_fail_unless(FALSE, "Cannot change to testbed directory %s.", testbed); smlTrace(TRACE_INTERNAL, "%s: Seting up %s at %s", __func__, VA_STRING(fkt_name), VA_STRING(testbed)); } @@ -112,9 +112,9 @@ { char *command = g_strdup_printf("rm -rf %s", path); if (olddir && chdir(olddir)) - fail("Cannot change to old directory \"%s\".", olddir); + sml_fail_unless(FALSE, "Cannot change to old directory \"%s\".", olddir); if (system(command)) - fail("Cannot execute command \"%s\".", command); + sml_fail_unless(FALSE, "Cannot execute command \"%s\".", command); g_free(command); smlTrace(TRACE_INTERNAL, "%s: Tearing down %s", __func__, VA_STRING(path)); g_free(path); |
From: <svn...@op...> - 2009-03-02 14:31:07
|
Author: bellmich Date: Mon Mar 2 15:30:56 2009 New Revision: 962 URL: http://libsyncml.opensync.org/changeset/962 Log: make all tests thread safe by using only sml_fail_unless Modified: trunk/tests/check_data_sync_api.c trunk/tests/check_ds.c trunk/tests/check_http.c trunk/tests/check_obex.c trunk/tests/check_session.c trunk/tests/check_xml_assembler.c trunk/tests/mobiles/libsyncml_ds_server.c trunk/tests/mobiles/obex_mobile_ds_client.c Modified: trunk/tests/check_data_sync_api.c ============================================================================== --- trunk/tests/check_data_sync_api.c Mon Mar 2 15:17:28 2009 (r961) +++ trunk/tests/check_data_sync_api.c Mon Mar 2 15:30:56 2009 (r962) @@ -64,7 +64,7 @@ char *name = g_strdup_printf("%d", count); if (!smlDataSyncAddChange(client, client_source, SML_CHANGE_ADD, name , test_data, strlen(test_data), NULL, error)) - fail("%s", smlErrorPrint(error)); + sml_fail_unless(FALSE, "%s", smlErrorPrint(error)); smlSafeCFree(&name); } } @@ -84,7 +84,7 @@ switch (type) { case SML_DATA_SYNC_EVENT_ERROR: - fail("error from ds api: %s", smlErrorPrint(&error)); + sml_fail_unless(FALSE, "error from ds api: %s", smlErrorPrint(&error)); break; case SML_DATA_SYNC_EVENT_CONNECT: /* g_message("Remote device was successfully connected."); */ @@ -152,12 +152,12 @@ /* clients should never receive a change in this test */ if (dsObject == client) - fail("A change was received from the server."); + sml_fail_unless(FALSE, "A change was received from the server."); /* check the source */ if (strcmp(server_source, source)) - fail("The source %s is wrong.", server_source); + sml_fail_unless(FALSE, "The source %s is wrong.", server_source); /* handle the item */ GList *list = client_items; @@ -175,7 +175,7 @@ /* item with correct uid */ if (strcmp(list->data, data)) - fail("The data of the item %s was wrong(%s != %s).", uid, data, list->data); + sml_fail_unless(FALSE, "The data of the item %s was wrong(%s != %s).", uid, data, list->data); } smlSafeCFree(&data); @@ -318,7 +318,7 @@ return; error: - fail("%s", smlErrorPrint(&error)); + sml_fail_unless(FALSE, "%s", smlErrorPrint(&error)); } void run_testbed() @@ -367,7 +367,7 @@ return; error: - fail("%s", smlErrorPrint(&error)); + sml_fail_unless(FALSE, "%s", smlErrorPrint(&error)); } START_TEST (check_text_vcard_21) @@ -402,7 +402,7 @@ return; error: - fail("%s", smlErrorPrint(&error)); + sml_fail_unless(FALSE, "%s", smlErrorPrint(&error)); } END_TEST @@ -441,7 +441,7 @@ return; error: - fail("%s", smlErrorPrint(&error)); + sml_fail_unless(FALSE, "%s", smlErrorPrint(&error)); } END_TEST @@ -477,7 +477,7 @@ return; error: - fail("%s", smlErrorPrint(&error)); + sml_fail_unless(FALSE, "%s", smlErrorPrint(&error)); } END_TEST Modified: trunk/tests/check_ds.c ============================================================================== --- trunk/tests/check_ds.c Mon Mar 2 15:17:28 2009 (r961) +++ trunk/tests/check_ds.c Mon Mar 2 15:30:56 2009 (r962) @@ -280,7 +280,7 @@ g_assert(!data); g_assert(size == 0); } else { - fail("An unexpected SyncML change type %d was received.", type); + sml_fail_unless(FALSE, "An unexpected SyncML change type %d was received.", type); } if (data) @@ -452,7 +452,7 @@ smlDsSessionRecvMap(session, command, corr->dsession); break; default: - fail("An unexpected command type %d was received.", command->type); + sml_fail_unless(FALSE, "An unexpected command type %d was received.", command->type); break; } break; @@ -463,7 +463,7 @@ smlDsSessionRecvSync(session, command, corr->dsession); break; default: - fail("An unexpected command type %d was received.", command->type); + sml_fail_unless(FALSE, "An unexpected command type %d was received.", command->type); break; } break; @@ -474,10 +474,10 @@ g_atomic_int_add(&session_ends, 1); break; case SML_SESSION_EVENT_ERROR: - fail("%s", smlErrorPrint(&error)); + sml_fail_unless(FALSE, "%s", smlErrorPrint(&error)); break; default: - fail("An unexpected session event %d was received.", type); + sml_fail_unless(FALSE, "An unexpected session event %d was received.", type); break; } Modified: trunk/tests/check_http.c ============================================================================== --- trunk/tests/check_http.c Mon Mar 2 15:17:28 2009 (r961) +++ trunk/tests/check_http.c Mon Mar 2 15:30:56 2009 (r962) @@ -171,7 +171,7 @@ g_atomic_int_inc(&client_errors); break; default: - fail("An unexpected transport event %d was received.", type); + sml_fail_unless(FALSE, "An unexpected transport event %d was received.", type); break; } @@ -223,7 +223,7 @@ } else if (GPOINTER_TO_INT(userdata) == 3) { sml_fail_unless(smlTransportDisconnect(tsp, link, &locerror), "%s", smlErrorPrint(&locerror)); } else { - fail("Some unexpected userdata %i was detected.", GPOINTER_TO_INT(userdata)); + sml_fail_unless(FALSE, "Some unexpected userdata %i was detected.", GPOINTER_TO_INT(userdata)); } } else if (!strcmp(data->data, "error")) { sml_fail_unless(data->size == 6, NULL); @@ -235,11 +235,11 @@ smlTransportSetError(tsp, link, &newerror); smlErrorDeref(&newerror); } else { - fail("The received data was not expected (%s).", data->data); + sml_fail_unless(FALSE, "The received data was not expected (%s).", data->data); } break; default: - fail("An unexpected transport event %d was received.", type); + sml_fail_unless(FALSE, "An unexpected transport event %d was received.", type); break; } Modified: trunk/tests/check_obex.c ============================================================================== --- trunk/tests/check_obex.c Mon Mar 2 15:17:28 2009 (r961) +++ trunk/tests/check_obex.c Mon Mar 2 15:30:56 2009 (r962) @@ -128,7 +128,7 @@ g_atomic_int_inc(&client_errors); break; default: - fail("An unexpected transport event %d was received.", type); + sml_fail_unless(FALSE, "An unexpected transport event %d was received.", type); break; } @@ -169,7 +169,7 @@ } else if (GPOINTER_TO_INT(userdata) == 3) { sml_fail_unless(smlTransportDisconnect(tsp, link, &error), NULL); } else { - fail("The userdata %d was not expected.", GPOINTER_TO_INT(userdata)); + sml_fail_unless(FALSE, "The userdata %d was not expected.", GPOINTER_TO_INT(userdata)); } } else if (!strcmp(data->data, "error")) { sml_fail_unless(data->size == 6, NULL); @@ -181,7 +181,7 @@ smlTransportSetError(tsp, link, &newerror); smlErrorDeref(&newerror); } else { - fail("The received data was not expected (%s).", data->data); + sml_fail_unless(FALSE, "The received data was not expected (%s).", data->data); } break; case SML_TRANSPORT_EVENT_CONNECT_DONE: @@ -195,10 +195,10 @@ g_atomic_int_inc(&server_disconnect_done); break; case SML_TRANSPORT_EVENT_ERROR: - fail("%s", smlErrorPrint(&error)); + sml_fail_unless(FALSE, "%s", smlErrorPrint(&error)); break; default: - fail("An unexpected transport event %d was received.", type); + sml_fail_unless(FALSE, "An unexpected transport event %d was received.", type); break; } Modified: trunk/tests/check_session.c ============================================================================== --- trunk/tests/check_session.c Mon Mar 2 15:17:28 2009 (r961) +++ trunk/tests/check_session.c Mon Mar 2 15:30:56 2009 (r962) @@ -458,7 +458,7 @@ if (GPOINTER_TO_INT(userdata) == 2) g_atomic_int_inc(&errors_received); else { - fail("%s", smlErrorPrint(&error)); + sml_fail_unless(FALSE, "%s", smlErrorPrint(&error)); abort(); } break; Modified: trunk/tests/check_xml_assembler.c ============================================================================== --- trunk/tests/check_xml_assembler.c Mon Mar 2 15:17:28 2009 (r961) +++ trunk/tests/check_xml_assembler.c Mon Mar 2 15:30:56 2009 (r962) @@ -1519,7 +1519,7 @@ sml_fail_unless(smlAssemblerAddStatus(assm, status, &error) == SML_ASSEMBLER_RESULT_OK, NULL); sml_fail_unless(error == NULL, NULL); } else if (res != SML_ASSEMBLER_RESULT_OK) { - fail("%s", smlErrorPrint(&error)); + sml_fail_unless(FALSE, "%s", smlErrorPrint(&error)); } smlStatusUnref(status); @@ -1549,7 +1549,7 @@ sml_fail_unless(smlAssemblerStartCommand(assm, NULL, cmd1, &error), NULL); sml_fail_unless(error == NULL, NULL); } else if (res != SML_ASSEMBLER_RESULT_OK) { - fail("%s", smlErrorPrint(&error)); + sml_fail_unless(FALSE, "%s", smlErrorPrint(&error)); } smlCommandUnref(cmd1); Modified: trunk/tests/mobiles/libsyncml_ds_server.c ============================================================================== --- trunk/tests/mobiles/libsyncml_ds_server.c Mon Mar 2 15:17:28 2009 (r961) +++ trunk/tests/mobiles/libsyncml_ds_server.c Mon Mar 2 15:30:56 2009 (r962) @@ -49,7 +49,7 @@ switch (type) { case SML_DATA_SYNC_EVENT_ERROR: - fail("%s", smlErrorPrint(&error)); + sml_fail_unless(FALSE, "%s", smlErrorPrint(&error)); break; case SML_DATA_SYNC_EVENT_CONNECT: case SML_DATA_SYNC_EVENT_DISCONNECT: @@ -65,7 +65,7 @@ "%s", smlErrorPrint(&error)); break; default: - fail("The unexpected data sync event %d was received.", type); + sml_fail_unless(FALSE, "The unexpected data sync event %d was received.", type); break; } smlTrace(TRACE_EXIT, "%s", __func__); @@ -117,7 +117,7 @@ "%s", smlErrorPrint(&error)); break; default: - fail("The unsupported transport type %d was used for testing.", tspType); + sml_fail_unless(FALSE, "The unsupported transport type %d was used for testing.", tspType); } sml_fail_unless( Modified: trunk/tests/mobiles/obex_mobile_ds_client.c ============================================================================== --- trunk/tests/mobiles/obex_mobile_ds_client.c Mon Mar 2 15:17:28 2009 (r961) +++ trunk/tests/mobiles/obex_mobile_ds_client.c Mon Mar 2 15:30:56 2009 (r962) @@ -267,7 +267,7 @@ data->data, data->size, libsyncml_msg_notification_data, libsyncml_msg_notification_size)) - fail("wrong notification message"); + sml_fail_unless(FALSE, "wrong notification message"); mobile_state = TEST_MOBILE_STATE_WAIT_FOR_ALERT; obex_mobile_send(link, mobile_msg_alert_data, mobile_msg_alert_size); } else if (mobile_state == TEST_MOBILE_STATE_WAIT_FOR_ALERT) { @@ -276,7 +276,7 @@ data->data, data->size, libsyncml_msg_alert_data, libsyncml_msg_alert_size)) - fail("wrong alert message"); + sml_fail_unless(FALSE, "wrong alert message"); mobile_state = TEST_MOBILE_STATE_WAIT_FOR_SYNC; obex_mobile_send(link, mobile_msg_sync_data, mobile_msg_sync_size); } else if (mobile_state == TEST_MOBILE_STATE_WAIT_FOR_SYNC) { @@ -285,7 +285,7 @@ data->data, data->size, libsyncml_msg_sync_data, libsyncml_msg_sync_size)) - fail("wrong sync message"); + sml_fail_unless(FALSE, "wrong sync message"); mobile_state = TEST_MOBILE_STATE_WAIT_FOR_END; obex_mobile_send(link, mobile_msg_map_data, mobile_msg_map_size); } else if (mobile_state == TEST_MOBILE_STATE_WAIT_FOR_END) { @@ -294,13 +294,13 @@ data->data, data->size, libsyncml_msg_end_data, libsyncml_msg_end_size)) - fail("wrong end message"); + sml_fail_unless(FALSE, "wrong end message"); mobile_state = TEST_MOBILE_STATE_FINISHED; /* The disconnect must be issued by obex client * but the mobile is the OBEX server. */ } else { - fail("The unexpected mobile state %d is set.", mobile_state); + sml_fail_unless(FALSE, "The unexpected mobile state %d is set.", mobile_state); } break; case SML_TRANSPORT_EVENT_CONNECT_DONE: @@ -312,10 +312,10 @@ mobile_state = TEST_MOBILE_STATE_DISCONNECTED; break; case SML_TRANSPORT_EVENT_ERROR: - fail("%s", smlErrorPrint(&error)); + sml_fail_unless(FALSE, "%s", smlErrorPrint(&error)); break; default: - fail("The unexpected transport event %d was received.", type); + sml_fail_unless(FALSE, "The unexpected transport event %d was received.", type); break; } |
From: <svn...@op...> - 2009-03-02 14:17:36
|
Author: bellmich Date: Mon Mar 2 15:17:28 2009 New Revision: 961 URL: http://libsyncml.opensync.org/changeset/961 Log: fixed blocking all sml_fail_unless after one test failed Modified: trunk/tests/support.c Modified: trunk/tests/support.c ============================================================================== --- trunk/tests/support.c Mon Mar 2 14:50:12 2009 (r960) +++ trunk/tests/support.c Mon Mar 2 15:17:28 2009 (r961) @@ -77,6 +77,12 @@ setuid(65534); if (!g_thread_supported ()) g_thread_init (NULL); + +#ifndef THREAD_SAFE_CHECK + /* unlock static mutex lock if locked from earlier error */ + g_static_mutex_trylock(&__libsyncml_check_mutex); + g_static_mutex_unlock(&__libsyncml_check_mutex); +#endif if (fkt_name) { testbed = g_strdup_printf("%s/testbed.XXXXXX", g_get_tmp_dir()); |
From: <svn...@op...> - 2009-03-02 13:50:19
|
Author: bellmich Date: Mon Mar 2 14:50:12 2009 New Revision: 960 URL: http://libsyncml.opensync.org/changeset/960 Log: added workaround to make check thread safe if check is older than 0.9.7 Modified: trunk/CMakeLists.txt trunk/tests/check_sync.c trunk/tests/support.c trunk/tests/support.h Modified: trunk/CMakeLists.txt ============================================================================== --- trunk/CMakeLists.txt Thu Feb 26 13:51:11 2009 (r959) +++ trunk/CMakeLists.txt Mon Mar 2 14:50:12 2009 (r960) @@ -83,8 +83,12 @@ SET ( LIBSOUP22_MIN_VERSION "2.2.91" ) SET ( LIBSOUP24_MIN_VERSION "2.3.0.1" ) SET ( LIBWBXML2_MIN_VERSION "0.10.0" ) +SET ( CHECK_MIN_VERSION "0.9.7" ) #SET ( BLUEZ_MIN_VERSION "3.19" ) +## avoid caching of CHECK_FOUND without CHECK_MIN_VERSION +SET ( CHECK_FOUND OFF ) + FIND_PACKAGE( GLIB2 REQUIRED ) FIND_PACKAGE( GTHREAD2 REQUIRED ) FIND_PACKAGE( GOBJECT2 REQUIRED ) @@ -148,9 +152,19 @@ SET ( FATAL_ERROR_TRANSPORT "Could not find libsoup2 nor OpenObex! Please install at least one of these libraries (e.g. libsoup2-dev package)." ) ENDIF( NOT LIBSOUP2_FOUND AND NOT OPENOBEX_FOUND ) +OPTION( ENABLE_UNIT_TEST "enable unit tests" OFF ) +OPTION( THREAD_SAFE_CHECK "check is thread safe" OFF ) +IF(CHECK_FOUND) + SET( THREAD_SAFE_CHECK ON ) +ELSE(CHECK_FOUND) + ## perhaps to small version + ## these versions are not thread safe + SET ( CHECK_MIN_VERSION "" ) + FIND_PACKAGE( Check ) +ENDIF(CHECK_FOUND) IF(CHECK_FOUND) - OPTION( ENABLE_UNIT_TEST "enable unit tests" ON ) - SET( MEMORYCHECK_SUPPRESSIONS_FILE "${CMAKE_SOURCE_DIR}/tests/valgrind.supp" CACHE FILEPATH "akdnaksd" ) + SET( ENABLE_UNIT_TEST ON ) + SET( MEMORYCHECK_SUPPRESSIONS_FILE "${CMAKE_SOURCE_DIR}/tests/valgrind.supp" CACHE FILEPATH "valgrind.supp" ) INCLUDE( Testing ) ENDIF(CHECK_FOUND) @@ -214,6 +228,7 @@ SHOW_STATUS( ENABLE_TOOLS "building tools\t\t" ) SHOW_STATUS( ENABLE_TRACE "tracing tools\t\t" ) SHOW_STATUS( ENABLE_UNIT_TEST "unit tests\t\t\t" ) +SHOW_STATUS( THREAD_SAFE_CHECK "check is thread safe\t\t" CHECK_VERSION ) SHOW_STATUS( ENABLE_WBXML "WAP Binary XML\t\t" LIBWBXML2_VERSION ) SHOW_STATUS( ENABLE_HTTP "http transports\t\t" LIBSOUP2_VERSION ) SHOW_STATUS( ENABLE_OBEX "obex transports\t\t" OPENOBEX_VERSION ) Modified: trunk/tests/check_sync.c ============================================================================== --- trunk/tests/check_sync.c Thu Feb 26 13:51:11 2009 (r959) +++ trunk/tests/check_sync.c Mon Mar 2 14:50:12 2009 (r960) @@ -139,7 +139,7 @@ session_errors++; break; default: - fail("An unexpected manager event %d was received.", type); + sml_fail_unless(FALSE, "An unexpected manager event %d was received.", type); break; } @@ -315,7 +315,7 @@ sml_fail_unless(!data, NULL); sml_fail_unless(size == 0, NULL); } else { - fail("The received SyncML change type %d is unsupported.", type); + sml_fail_unless(FALSE, "The received SyncML change type %d is unsupported.", type); } if (data) Modified: trunk/tests/support.c ============================================================================== --- trunk/tests/support.c Thu Feb 26 13:51:11 2009 (r959) +++ trunk/tests/support.c Mon Mar 2 14:50:12 2009 (r960) @@ -22,6 +22,10 @@ #include <libsyncml/sml_error_internals.h> #include <libxml/parser.h> +#ifndef THREAD_SAFE_CHECK +GStaticMutex __libsyncml_check_mutex = G_STATIC_MUTEX_INIT; +#endif + /* FIXME: These settings should be controlled by the test environment. * FIXME: The hard coding of the environment creates an unreal test scenario. * FIXME: The build host environment must be changed appropriately. Modified: trunk/tests/support.h ============================================================================== --- trunk/tests/support.h Thu Feb 26 13:51:11 2009 (r959) +++ trunk/tests/support.h Mon Mar 2 14:50:12 2009 (r960) @@ -29,10 +29,29 @@ void create_case(Suite *s, const char *name, TFun function); SmlParser *start_parser(const char *data, SmlError **error); -#define sml_fail_unless(expr, ...);\ - {\ - int _result = expr;\ - fail_unless(_result, ## __VA_ARGS__);\ - if (!_result) smlAssertMsg(0, g_strdup_printf(__VA_ARGS__));\ - } +#ifdef THREAD_SAFE_CHECK + #define sml_fail_unless(expr, ...);\ + {\ + int _result = expr;\ + fail_unless(_result, ## __VA_ARGS__);\ + if (!_result) smlAssertMsg(0, g_strdup_printf(__VA_ARGS__));\ + } + +#else + + /* If check is earlier than 0.9.7 then it is not thread safe. */ + + extern GStaticMutex __libsyncml_check_mutex; + + #define sml_fail_unless(expr, ...);\ + {\ + g_static_mutex_lock(&__libsyncml_check_mutex);\ + int _result = expr;\ + fail_unless(_result, ## __VA_ARGS__);\ + if (!_result) smlAssertMsg(0, g_strdup_printf(__VA_ARGS__));\ + g_static_mutex_unlock(&__libsyncml_check_mutex);\ + } + + +#endif /* THREAD_SAFE_CHECK */ |
From: <svn...@op...> - 2009-03-02 13:11:05
|
Author: bricks Date: Mon Mar 2 14:10:56 2009 New Revision: 5279 URL: http://www.opensync.org/changeset/5279 Log: added support for min version in cmake libcheck module Modified: branches/3rd-party-cmake-modules/modules/FindCheck.cmake Modified: branches/3rd-party-cmake-modules/modules/FindCheck.cmake ============================================================================== --- branches/3rd-party-cmake-modules/modules/FindCheck.cmake Thu Feb 26 09:03:38 2009 (r5278) +++ branches/3rd-party-cmake-modules/modules/FindCheck.cmake Mon Mar 2 14:10:56 2009 (r5279) @@ -6,7 +6,7 @@ # CHECK_LIBRARIES - check library # # Copyright (c) 2007 Daniel Gollub <dg...@su...> -# Copyright (c) 2007 Bjoern Ricks <b....@fh...> +# Copyright (c) 2007-2009 Bjoern Ricks <bjo...@gm...> # # Redistribution and use is allowed according to the terms of the New # BSD license. @@ -15,11 +15,20 @@ INCLUDE( FindPkgConfig ) -# Take care about check.pc settings -PKG_SEARCH_MODULE( CHECK check ) +IF ( Check_FIND_REQUIRED ) + SET( _pkgconfig_REQUIRED "REQUIRED" ) +ELSE( Check_FIND_REQUIRED ) + SET( _pkgconfig_REQUIRED "" ) +ENDIF ( Check_FIND_REQUIRED ) + +IF ( CHECK_MIN_VERSION ) + PKG_SEARCH_MODULE( CHECK ${_pkgconfig_REQUIRED} check>=${CHECK_MIN_VERSION} ) +ELSE ( CHECK_MIN_VERSION ) + PKG_SEARCH_MODULE( CHECK ${_pkgconfig_REQUIRED} check ) +ENDIF ( CHECK_MIN_VERSION ) # Look for CHECK include dir and libraries -IF( NOT CHECK_FOUND ) +IF( NOT CHECK_FOUND AND NOT PKG_CONFIG_FOUND ) FIND_PATH( CHECK_INCLUDE_DIRS check.h ) @@ -39,7 +48,7 @@ ENDIF ( NOT Check_FIND_QUIETLY ) ENDIF ( Check_FIND_REQUIRED ) ENDIF ( CHECK_INCLUDE_DIRS AND CHECK_LIBRARIES ) -ENDIF( NOT CHECK_FOUND ) +ENDIF( NOT CHECK_FOUND AND NOT PKG_CONFIG_FOUND ) # Hide advanced variables from CMake GUIs MARK_AS_ADVANCED( CHECK_INCLUDE_DIRS CHECK_LIBRARIES ) |
From: <svn...@op...> - 2009-02-26 13:00:33
|
Author: bellmich Date: Thu Feb 26 13:51:11 2009 New Revision: 959 URL: http://libsyncml.opensync.org/changeset/959 Log: libxml initialization and cleanup - added cleanup_environment with xmlCleanupParser - added xmlInitParser to configure_environment - added cleanup_environment to all tests Modified: trunk/tests/check_base64.c trunk/tests/check_data_sync_api.c trunk/tests/check_devinf.c trunk/tests/check_ds.c trunk/tests/check_elements.c trunk/tests/check_error.c trunk/tests/check_http.c trunk/tests/check_manager.c trunk/tests/check_md5.c trunk/tests/check_obex.c trunk/tests/check_san.c trunk/tests/check_session.c trunk/tests/check_sync.c trunk/tests/check_wbxml_assembler.c trunk/tests/check_wbxml_parser.c trunk/tests/check_xml_assembler.c trunk/tests/check_xml_fix_broken_item_data.c trunk/tests/check_xml_parser.c trunk/tests/mobiles/test_mobile.c trunk/tests/support.c trunk/tests/support.h Modified: trunk/tests/check_base64.c ============================================================================== --- trunk/tests/check_base64.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_base64.c Thu Feb 26 13:51:11 2009 (r959) @@ -279,5 +279,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_data_sync_api.c ============================================================================== --- trunk/tests/check_data_sync_api.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_data_sync_api.c Thu Feb 26 13:51:11 2009 (r959) @@ -506,5 +506,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_devinf.c ============================================================================== --- trunk/tests/check_devinf.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_devinf.c Thu Feb 26 13:51:11 2009 (r959) @@ -414,8 +414,6 @@ { configure_environment(); - smlLibxmlRef(); - int nf; Suite *s = devinf_suite(); @@ -426,7 +424,7 @@ nf = srunner_ntests_failed(sr); srunner_free(sr); - smlLibxmlUnref(); + cleanup_environment(); return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_ds.c ============================================================================== --- trunk/tests/check_ds.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_ds.c Thu Feb 26 13:51:11 2009 (r959) @@ -2494,5 +2494,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_elements.c ============================================================================== --- trunk/tests/check_elements.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_elements.c Thu Feb 26 13:51:11 2009 (r959) @@ -353,5 +353,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_error.c ============================================================================== --- trunk/tests/check_error.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_error.c Thu Feb 26 13:51:11 2009 (r959) @@ -250,5 +250,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_http.c ============================================================================== --- trunk/tests/check_http.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_http.c Thu Feb 26 13:51:11 2009 (r959) @@ -973,5 +973,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_manager.c ============================================================================== --- trunk/tests/check_manager.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_manager.c Thu Feb 26 13:51:11 2009 (r959) @@ -686,8 +686,6 @@ { configure_environment(); - smlLibxmlRef(); - int nf; Suite *s = manager_suite(); @@ -698,7 +696,7 @@ nf = srunner_ntests_failed(sr); srunner_free(sr); - smlLibxmlUnref(); + cleanup_environment(); return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_md5.c ============================================================================== --- trunk/tests/check_md5.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_md5.c Thu Feb 26 13:51:11 2009 (r959) @@ -148,5 +148,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_obex.c ============================================================================== --- trunk/tests/check_obex.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_obex.c Thu Feb 26 13:51:11 2009 (r959) @@ -924,5 +924,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_san.c ============================================================================== --- trunk/tests/check_san.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_san.c Thu Feb 26 13:51:11 2009 (r959) @@ -598,5 +598,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_session.c ============================================================================== --- trunk/tests/check_session.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_session.c Thu Feb 26 13:51:11 2009 (r959) @@ -2658,5 +2658,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_sync.c ============================================================================== --- trunk/tests/check_sync.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_sync.c Thu Feb 26 13:51:11 2009 (r959) @@ -2109,5 +2109,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_wbxml_assembler.c ============================================================================== --- trunk/tests/check_wbxml_assembler.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_wbxml_assembler.c Thu Feb 26 13:51:11 2009 (r959) @@ -934,6 +934,9 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } #else Modified: trunk/tests/check_wbxml_parser.c ============================================================================== --- trunk/tests/check_wbxml_parser.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_wbxml_parser.c Thu Feb 26 13:51:11 2009 (r959) @@ -797,5 +797,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_xml_assembler.c ============================================================================== --- trunk/tests/check_xml_assembler.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_xml_assembler.c Thu Feb 26 13:51:11 2009 (r959) @@ -1798,5 +1798,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_xml_fix_broken_item_data.c ============================================================================== --- trunk/tests/check_xml_fix_broken_item_data.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_xml_fix_broken_item_data.c Thu Feb 26 13:51:11 2009 (r959) @@ -242,5 +242,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_xml_parser.c ============================================================================== --- trunk/tests/check_xml_parser.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/check_xml_parser.c Thu Feb 26 13:51:11 2009 (r959) @@ -1733,5 +1733,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/mobiles/test_mobile.c ============================================================================== --- trunk/tests/mobiles/test_mobile.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/mobiles/test_mobile.c Thu Feb 26 13:51:11 2009 (r959) @@ -83,6 +83,9 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + cleanup_environment(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/support.c ============================================================================== --- trunk/tests/support.c Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/support.c Thu Feb 26 13:51:11 2009 (r959) @@ -20,6 +20,7 @@ #include "support.h" #include <libsyncml/sml_error_internals.h> +#include <libxml/parser.h> /* FIXME: These settings should be controlled by the test environment. * FIXME: The hard coding of the environment creates an unreal test scenario. @@ -55,6 +56,13 @@ */ if (!g_setenv("CK_FORK", "no", FALSE)) g_warning("CK_FORK is already set."); + + xmlInitParser(); +} + +void cleanup_environment() +{ + xmlCleanupParser(); } char *olddir = NULL; Modified: trunk/tests/support.h ============================================================================== --- trunk/tests/support.h Thu Feb 26 13:49:35 2009 (r958) +++ trunk/tests/support.h Thu Feb 26 13:51:11 2009 (r959) @@ -23,6 +23,7 @@ #include <libsyncml/syncml_internals.h> void configure_environment(); +void cleanup_environment(); char *setup_testbed(char *fkt_name); void destroy_testbed(char *path); void create_case(Suite *s, const char *name, TFun function); |
From: <svn...@op...> - 2009-02-26 12:55:29
|
Author: bellmich Date: Thu Feb 26 13:49:35 2009 New Revision: 958 URL: http://libsyncml.opensync.org/changeset/958 Log: libxml initialization and cleanup can only be handled correctly by the main thread of the process Modified: trunk/libsyncml/parser/sml_xml_assm.c trunk/libsyncml/parser/sml_xml_parse.c trunk/libsyncml/sml_support.c trunk/libsyncml/sml_support.h Modified: trunk/libsyncml/parser/sml_xml_assm.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_assm.c Wed Feb 25 16:53:34 2009 (r957) +++ trunk/libsyncml/parser/sml_xml_assm.c Thu Feb 26 13:49:35 2009 (r958) @@ -1504,8 +1504,6 @@ g_mutex_free(assm->mutex); smlSafeFree((gpointer *)&assm); - smlLibxmlUnref(); - smlTrace(TRACE_EXIT, "%s", __func__); } @@ -1960,8 +1958,6 @@ functions->flush = (SmlAssemblerFlushFunction)smlXmlAssemblerFlush; functions->restore_cmds = (SmlAssemblerRestoreCommandsFunction)smlXmlAssemblerRestoreCommands; - smlLibxmlRef(); - smlTrace(TRACE_EXIT, "%s: %p", __func__, assm); return assm; @@ -2405,8 +2401,6 @@ version = devinf->version; smlAssert(devinf->version == version); - smlLibxmlRef(); - SmlXmlAssembler *assm = smlTryMalloc0(sizeof(SmlXmlAssembler), error); if (!assm) goto error; @@ -2560,8 +2554,6 @@ smlSafeFree((gpointer *)&assm); - smlLibxmlUnref(); - smlTrace(TRACE_INTERNAL, "Message Assembled: %s", *data); smlTrace(TRACE_EXIT, "%s", __func__); @@ -2575,7 +2567,6 @@ error_free_assm: smlSafeFree((gpointer *)&assm); error: - smlLibxmlUnref(); g_warning("%s: %s", __func__, smlErrorPrint(error)); smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); return FALSE; Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Wed Feb 25 16:53:34 2009 (r957) +++ trunk/libsyncml/parser/sml_xml_parse.c Thu Feb 26 13:49:35 2009 (r958) @@ -1904,7 +1904,6 @@ parser->got_command = FALSE; /* Create the new parser */ - smlLibxmlRef(); parser->reader = xmlReaderForMemory(parser->data, parser->size, "/", NULL, XML_PARSE_NONET | XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_NOCDATA); if (!parser->reader) { smlErrorSet(error, SML_ERROR_GENERIC, "Unable to create new reader"); @@ -1925,7 +1924,6 @@ error_free_reader: xmlFreeTextReader(parser->reader); - smlLibxmlUnref(); error: parser->reader = NULL; if (parser->data) @@ -1985,7 +1983,6 @@ goto error; xmlFreeTextReader(parser->reader); - smlLibxmlUnref(); parser->reader = NULL; parser->size = 0; smlSafeCFree(&(parser->data)); @@ -2005,7 +2002,6 @@ if (parser->reader) { xmlFreeTextReader(parser->reader); - smlLibxmlUnref(); } if (parser->data) smlSafeCFree(&(parser->data)); @@ -3280,7 +3276,6 @@ goto error; /* Create the new parser */ - smlLibxmlRef(); parser->reader = xmlReaderForMemory(data, size, "/", NULL, XML_PARSE_NONET | XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_NOCDATA | XML_PARSER_SUBST_ENTITIES); if (!parser->reader) { smlErrorSet(error, SML_ERROR_GENERIC, "Unable to create new reader"); @@ -3453,7 +3448,6 @@ xmlFreeTextReader(parser->reader); parser->reader = NULL; - smlLibxmlUnref(); smlSafeFree((gpointer *)&parser); smlTrace(TRACE_EXIT, "%s", __func__); @@ -3463,7 +3457,6 @@ if (parser && parser->reader) { xmlFreeTextReader(parser->reader); parser->reader = NULL; - smlLibxmlUnref(); } if (parser) smlSafeFree((gpointer *)&parser); Modified: trunk/libsyncml/sml_support.c ============================================================================== --- trunk/libsyncml/sml_support.c Wed Feb 25 16:53:34 2009 (r957) +++ trunk/libsyncml/sml_support.c Thu Feb 26 13:49:35 2009 (r958) @@ -509,37 +509,4 @@ smlSafeFree((gpointer *)address); } -static size_t __sml_libxml_ref_count = 0; -GStaticMutex __sml_libxml_mutex = G_STATIC_MUTEX_INIT; - -void smlLibxmlRef() -{ - g_static_mutex_lock(&__sml_libxml_mutex); - if (__sml_libxml_ref_count > 0) { - __sml_libxml_ref_count++; - } else if (__sml_libxml_ref_count == 0) { - __sml_libxml_ref_count++; - xmlInitParser(); - smlTrace(TRACE_INTERNAL, "%s: libxml initialized", __func__); - } - g_static_mutex_unlock(&__sml_libxml_mutex); -} - -void smlLibxmlUnref() -{ - g_static_mutex_lock(&__sml_libxml_mutex); - if (__sml_libxml_ref_count > 1) { - __sml_libxml_ref_count--; - } else if (__sml_libxml_ref_count == 1) { - __sml_libxml_ref_count--; - xmlCleanupParser(); - xmlCleanupGlobals(); - smlTrace(TRACE_INTERNAL, "%s: libxml cleaned up", __func__); - } else if (__sml_libxml_ref_count == 0) { - g_warning("libsyncml: libxml is not referenced but somebody tries to cleanup."); - smlTrace(TRACE_ERROR, "%s: reference counter is already zero.", __func__); - } - g_static_mutex_unlock(&__sml_libxml_mutex); -} - /*@}*/ Modified: trunk/libsyncml/sml_support.h ============================================================================== --- trunk/libsyncml/sml_support.h Wed Feb 25 16:53:34 2009 (r957) +++ trunk/libsyncml/sml_support.h Thu Feb 26 13:49:35 2009 (r958) @@ -66,7 +66,4 @@ void smlSafeFree(gpointer *address); void smlSafeCFree(char **address); -void smlLibxmlRef(); -void smlLibxmlUnref(); - #endif //_SML_SUPPORT_H_ |
From: <svn...@op...> - 2009-02-26 08:03:44
|
Author: bricks Date: Thu Feb 26 09:03:38 2009 New Revision: 5278 URL: http://www.opensync.org/changeset/5278 Log: sink userdata gets passed to all objtype sink functions since r5277 Modified: plugins/file-sync/src/file_sync.c Modified: plugins/file-sync/src/file_sync.c ============================================================================== --- plugins/file-sync/src/file_sync.c Thu Feb 26 09:02:23 2009 (r5277) +++ plugins/file-sync/src/file_sync.c Thu Feb 26 09:03:38 2009 (r5278) @@ -55,13 +55,13 @@ return hash; } -static void osync_filesync_connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) +static void osync_filesync_connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { OSyncError *error = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); - OSyncFileDir *dir = osync_objtype_sink_get_userdata(sink); + OSyncFileDir *dir = userdata; OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); osync_bool anchormatch; @@ -95,7 +95,7 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink , info, ctx, change, userdata); - OSyncFileDir *dir = osync_objtype_sink_get_userdata(sink); + OSyncFileDir *dir = userdata; OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); OSyncError *error = NULL; @@ -166,11 +166,11 @@ return FALSE; } -static osync_bool osync_filesync_write(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *data) +static osync_bool osync_filesync_write(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, data); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, userdata); - OSyncFileDir *dir = osync_objtype_sink_get_userdata(sink); + OSyncFileDir *dir = userdata; OSyncError *error = NULL; OSyncData *odata = NULL; char *buffer = NULL; @@ -196,7 +196,7 @@ if (g_file_test(filename, G_FILE_TEST_EXISTS)) { const char *newid = g_strdup_printf ("%s-new", osync_change_get_uid(change)); osync_change_set_uid(change, newid); - osync_filesync_write(sink, info, ctx, change, data); + osync_filesync_write(sink, info, ctx, change, userdata); //osync_error_set(&error, OSYNC_ERROR_EXISTS, "Entry already exists : %s", filename); //goto error; } @@ -384,11 +384,11 @@ osync_trace(TRACE_EXIT, "%s", __func__); } -static void osync_filesync_get_changes(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync, void *data) +static void osync_filesync_get_changes(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %i, %p)", __func__, sink, info, ctx, slow_sync, data); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %i, %p)", __func__, sink, info, ctx, slow_sync, userdata); - OSyncFileDir *dir = osync_objtype_sink_get_userdata(sink); + OSyncFileDir *dir = userdata; OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); OSyncError *error = NULL; @@ -446,15 +446,15 @@ osync_trace(TRACE_EXIT, "%s", __func__); } -static void osync_filesync_commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *data) +static void osync_filesync_commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, data); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, userdata); - OSyncFileDir *dir = osync_objtype_sink_get_userdata(sink); + OSyncFileDir *dir = userdata; char *filename = NULL, *tmp; - if (!osync_filesync_write(sink, info, ctx, change, data)) { + if (!osync_filesync_write(sink, info, ctx, change, userdata)) { osync_trace(TRACE_EXIT_ERROR, "%s", __func__); return; } @@ -484,13 +484,13 @@ osync_trace(TRACE_EXIT, "%s", __func__); } -static void osync_filesync_sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) +static void osync_filesync_sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, data); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); OSyncError *error = NULL; - OSyncFileDir *dir = osync_objtype_sink_get_userdata(sink); + OSyncFileDir *dir = userdata; OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); if (!osync_anchor_update(anchor, dir->path, &error)) @@ -532,6 +532,7 @@ if (!dir) goto error_free_env; + dir->env = env; dir->sink = osync_plugin_info_nth_objtype(info, i); assert(dir->sink); |
From: <svn...@op...> - 2009-02-26 08:02:31
|
Author: bricks Date: Thu Feb 26 09:02:23 2009 New Revision: 5277 URL: http://www.opensync.org/changeset/5277 Log: Pass objtype sink userdata to all objtype sink plugin function instead of the plugin/client data fix for ticket #1018 Modified: trunk/opensync.sym trunk/opensync/client/opensync_client.c trunk/opensync/engine/opensync_obj_engine.c trunk/opensync/plugin/opensync_objtype_sink.h trunk/opensync/plugin/opensync_objtype_sink_internals.h trunk/tests/engine-tests/check_engine.c trunk/tests/mock-plugin/mock_sync.c trunk/wrapper/opensync-plugin.i Modified: trunk/opensync.sym ============================================================================== --- trunk/opensync.sym Wed Feb 25 21:54:21 2009 (r5276) +++ trunk/opensync.sym Thu Feb 26 09:02:23 2009 (r5277) @@ -407,7 +407,6 @@ osync_objtype_sink_get_preferred_format osync_objtype_sink_get_read osync_objtype_sink_get_slowsync -osync_objtype_sink_get_userdata osync_objtype_sink_get_write osync_objtype_sink_is_available osync_objtype_sink_is_enabled Modified: trunk/opensync/client/opensync_client.c ============================================================================== --- trunk/opensync/client/opensync_client.c Wed Feb 25 21:54:21 2009 (r5276) +++ trunk/opensync/client/opensync_client.c Thu Feb 26 09:02:23 2009 (r5277) @@ -967,7 +967,7 @@ goto error; osync_plugin_info_set_sink(client->plugin_info, sink); - osync_objtype_sink_connect(sink, client->plugin_data, client->plugin_info, context); + osync_objtype_sink_connect(sink, osync_objtype_sink_get_userdata(sink), client->plugin_info, context); osync_context_unref(context); } @@ -1022,7 +1022,7 @@ goto error; osync_plugin_info_set_sink(client->plugin_info, sink); - osync_objtype_sink_connect_done(sink, client->plugin_data, client->plugin_info, context); + osync_objtype_sink_connect_done(sink, osync_objtype_sink_get_userdata(sink), client->plugin_info, context); osync_context_unref(context); } @@ -1076,7 +1076,7 @@ goto error; osync_plugin_info_set_sink(client->plugin_info, sink); - osync_objtype_sink_disconnect(sink, client->plugin_data, client->plugin_info, context); + osync_objtype_sink_disconnect(sink, osync_objtype_sink_get_userdata(sink), client->plugin_info, context); osync_context_unref(context); } @@ -1141,7 +1141,7 @@ osync_plugin_info_set_sink(client->plugin_info, sink); - osync_objtype_sink_get_changes(sink, client->plugin_data, client->plugin_info, context); + osync_objtype_sink_get_changes(sink, osync_objtype_sink_get_userdata(sink), client->plugin_info, context); osync_context_unref(context); } @@ -1200,7 +1200,7 @@ osync_plugin_info_set_sink(client->plugin_info, sink); - osync_objtype_sink_read_change(sink, client->plugin_data, client->plugin_info, change, context); + osync_objtype_sink_read_change(sink, osync_objtype_sink_get_userdata(sink), client->plugin_info, change, context); osync_context_unref(context); } @@ -1247,7 +1247,7 @@ goto error; osync_plugin_info_set_sink(client->plugin_info, sink); - osync_objtype_sink_commit_change(sink, client->plugin_data, client->plugin_info, change, context); + osync_objtype_sink_commit_change(sink, osync_objtype_sink_get_userdata(sink), client->plugin_info, change, context); osync_change_unref(change); osync_context_unref(context); @@ -1300,7 +1300,7 @@ goto error; osync_plugin_info_set_sink(client->plugin_info, sink); - osync_objtype_sink_committed_all(sink, client->plugin_data, client->plugin_info, context); + osync_objtype_sink_committed_all(sink, osync_objtype_sink_get_userdata(sink), client->plugin_info, context); osync_context_unref(context); } @@ -1354,7 +1354,7 @@ goto error; osync_plugin_info_set_sink(client->plugin_info, sink); - osync_objtype_sink_sync_done(sink, client->plugin_data, client->plugin_info, context); + osync_objtype_sink_sync_done(sink, osync_objtype_sink_get_userdata(sink), client->plugin_info, context); osync_context_unref(context); } @@ -1521,7 +1521,7 @@ osync_trace(TRACE_INTERNAL, "plugin received command %i on sending queue", osync_message_get_command(message)); if ( (osync_message_get_command(message) == OSYNC_MESSAGE_QUEUE_ERROR) - || (osync_message_get_command(message) == OSYNC_MESSAGE_QUEUE_HUP) ) { + || (osync_message_get_command(message) == OSYNC_MESSAGE_QUEUE_HUP) ) { /* The remote side disconnected. So we can now disconnect as well and then * shutdown */ if (!osync_queue_disconnect(client->outgoing, &error)) Modified: trunk/opensync/engine/opensync_obj_engine.c ============================================================================== --- trunk/opensync/engine/opensync_obj_engine.c Wed Feb 25 21:54:21 2009 (r5276) +++ trunk/opensync/engine/opensync_obj_engine.c Thu Feb 26 09:02:23 2009 (r5277) @@ -327,7 +327,7 @@ static void _osync_obj_engine_read_ignored_callback(OSyncClientProxy *proxy, void *userdata, OSyncError *error) { OSyncSinkEngine *sinkengine = userdata; - OSyncObjEngine *engine = sinkengine->engine; + /* OSyncObjEngine *engine = sinkengine->engine; */ /* TODO: Share _generate_read_event fucntion with _osync_obj_engine_read_callback? To report errors .. and handle _timeout problems of _read_ignored call. */ @@ -1052,8 +1052,8 @@ /* Now we can multiply the winner in the mapping */ osync_trace(TRACE_INTERNAL, "Multiplying %u mappings", osync_list_length(engine->mapping_engines)); for (p = engine->mapping_engines; p; p = p->next) { - OSyncMappingEngine *mapping_engine = p->data; - if (!osync_mapping_engine_multiply(mapping_engine, error)) + OSyncMappingEngine *mapping_engine = p->data; + if (!osync_mapping_engine_multiply(mapping_engine, error)) break; } Modified: trunk/opensync/plugin/opensync_objtype_sink.h ============================================================================== --- trunk/opensync/plugin/opensync_objtype_sink.h Wed Feb 25 21:54:21 2009 (r5276) +++ trunk/opensync/plugin/opensync_objtype_sink.h Thu Feb 26 09:02:23 2009 (r5277) @@ -214,21 +214,11 @@ * * @param sink Pointer to the sink * @param functions struct containing pointers to the sink functions - * @param userdata user data pointer that can be retrieved within the functions using osync_objtype_sink_get_userdata() + * @param userdata user data pointer that is passed to all objtype sink functions like connect(), commit(), ... * */ OSYNC_EXPORT void osync_objtype_sink_set_functions(OSyncObjTypeSink *sink, OSyncObjTypeSinkFunctions functions, void *userdata); -/** @brief Gets the user data from a sink - * - * Gets the user data from a sink, as previously set by osync_objtype_sink_set_functions() - * - * @param sink Pointer to the sink - * @returns the sink-specific user data - * - */ -OSYNC_EXPORT void *osync_objtype_sink_get_userdata(OSyncObjTypeSink *sink); - /** @brief Checks if a sink is enabled * Modified: trunk/opensync/plugin/opensync_objtype_sink_internals.h ============================================================================== --- trunk/opensync/plugin/opensync_objtype_sink_internals.h Wed Feb 25 21:54:21 2009 (r5276) +++ trunk/opensync/plugin/opensync_objtype_sink_internals.h Thu Feb 26 09:02:23 2009 (r5277) @@ -262,6 +262,16 @@ */ unsigned int osync_objtype_sink_get_read_timeout(OSyncObjTypeSink *sink); +/** @brief Gets the user data from a sink + * + * Gets the user data from a sink, as previously set by osync_objtype_sink_set_functions() + * + * @param sink Pointer to the sink + * @returns the sink-specific user data + * + */ +void *osync_objtype_sink_get_userdata(OSyncObjTypeSink *sink); + /*@}*/ #endif /*OPENSYNC_SINK_INTERNALS_H_*/ Modified: trunk/tests/engine-tests/check_engine.c ============================================================================== --- trunk/tests/engine-tests/check_engine.c Wed Feb 25 21:54:21 2009 (r5276) +++ trunk/tests/engine-tests/check_engine.c Thu Feb 26 09:02:23 2009 (r5277) @@ -139,6 +139,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 0); osync_assert(env->num_disconnect == 0); osync_assert(env->num_get_changes == 0); @@ -158,6 +159,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 1); osync_assert(env->num_disconnect == 0); osync_assert(env->num_get_changes == 1); @@ -177,6 +179,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 1); osync_assert(env->num_disconnect == 0); osync_assert(env->num_get_changes == 0); @@ -213,7 +216,7 @@ functions.disconnect = disconnect; functions.get_changes = get_changes; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_add_objtype(info, sink); osync_objtype_sink_unref(sink); @@ -229,6 +232,7 @@ { mock_env *env = data; + osync_assert(env); osync_assert(env->num_connect == 1); osync_assert(env->num_disconnect == 1); osync_assert(env->num_get_changes == 1); @@ -369,6 +373,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect < 3); osync_assert(env->num_disconnect == 0); osync_assert(env->num_get_changes == 0); @@ -388,6 +393,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect < 3); osync_assert(env->num_get_changes == 3); @@ -407,6 +413,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect == 0); osync_assert(env->num_get_changes < 3); @@ -426,6 +433,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect == 0); osync_assert(env->num_get_changes == 0); @@ -445,6 +453,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect == 3); osync_assert(env->num_get_changes == 3); @@ -464,6 +473,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect == 0); osync_assert(env->num_get_changes == 3); @@ -500,7 +510,7 @@ functions.disconnect = disconnect2; functions.get_changes = get_changes2; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_add_objtype(info, sink); osync_objtype_sink_unref(sink); @@ -517,7 +527,7 @@ functions.disconnect = disconnect2; functions.get_changes = get_changes2; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_add_objtype(info, sink); osync_objtype_sink_unref(sink); @@ -534,7 +544,7 @@ functions.disconnect = disconnect2; functions.get_changes = get_changes2; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_add_objtype(info, sink); osync_objtype_sink_unref(sink); @@ -548,7 +558,7 @@ functions.disconnect = main_disconnect2; functions.get_changes = main_get_changes2; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_set_main_sink(info, sink); osync_objtype_sink_unref(sink); @@ -564,6 +574,7 @@ { mock_env *env = data; + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect == 3); osync_assert(env->num_get_changes == 3); @@ -684,6 +695,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect < 3); osync_assert(env->num_disconnect == 0); osync_assert(env->num_get_changes == 0); @@ -704,6 +716,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect < 3); osync_assert(env->num_get_changes == 3); @@ -726,6 +739,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect == 0); osync_assert(env->num_get_changes < 3); @@ -746,6 +760,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect == 0); osync_assert(env->num_get_changes == 3); @@ -768,6 +783,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect == 0); osync_assert(env->num_get_changes == 0); @@ -794,6 +810,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect == 3); osync_assert(env->num_get_changes == 3); @@ -822,6 +839,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect == 0); osync_assert(env->num_get_changes == 3); @@ -849,6 +867,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect == 0); osync_assert(env->num_get_changes == 3); @@ -896,7 +915,7 @@ functions.get_changes = get_changes3; functions.sync_done = sync_done3; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_add_objtype(info, sink); osync_objtype_sink_unref(sink); @@ -914,7 +933,7 @@ functions.get_changes = get_changes3; functions.sync_done = sync_done3; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_add_objtype(info, sink); osync_objtype_sink_unref(sink); @@ -932,7 +951,7 @@ functions.get_changes = get_changes3; functions.sync_done = sync_done3; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_add_objtype(info, sink); osync_objtype_sink_unref(sink); @@ -947,7 +966,7 @@ functions.get_changes = main_get_changes3; functions.sync_done = main_sync_done3; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_set_main_sink(info, sink); osync_objtype_sink_unref(sink); @@ -1085,6 +1104,7 @@ mock_env *env = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_assert(env); osync_assert(env->num_connect == 3); osync_assert(env->num_disconnect == 3); osync_assert(env->num_get_changes == 3); @@ -1138,7 +1158,7 @@ functions.get_changes = get_changes3; functions.sync_done = sync_done3; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_add_objtype(info, sink); osync_objtype_sink_unref(sink); @@ -1156,7 +1176,7 @@ functions.get_changes = get_changes3; functions.sync_done = sync_done3; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_add_objtype(info, sink); osync_objtype_sink_unref(sink); @@ -1174,7 +1194,7 @@ functions.get_changes = get_changes3; functions.sync_done = sync_done3; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_add_objtype(info, sink); osync_objtype_sink_unref(sink); @@ -1189,7 +1209,7 @@ functions.get_changes = main_get_changes3; functions.sync_done = main_sync_done3; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_set_main_sink(info, sink); osync_objtype_sink_unref(sink); @@ -1465,7 +1485,7 @@ functions.get_changes = get_changes5; functions.commit = commit_change5; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_add_objtype(info, sink); osync_objtype_sink_unref(sink); @@ -1667,7 +1687,7 @@ functions.get_changes = get_changes6; functions.commit = commit_change5; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_add_objtype(info, sink); osync_objtype_sink_unref(sink); @@ -1871,7 +1891,7 @@ functions.get_changes = get_changes7; functions.commit = commit_change5; - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_plugin_info_add_objtype(info, sink); osync_objtype_sink_unref(sink); Modified: trunk/tests/mock-plugin/mock_sync.c ============================================================================== --- trunk/tests/mock-plugin/mock_sync.c Wed Feb 25 21:54:21 2009 (r5276) +++ trunk/tests/mock-plugin/mock_sync.c Thu Feb 26 09:02:23 2009 (r5277) @@ -54,7 +54,7 @@ { osync_bool anchor_compare_match; OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - MockDir *dir = osync_objtype_sink_get_userdata(sink); + MockDir *dir = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, data); @@ -104,7 +104,7 @@ static void mock_connect_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, data); - MockDir *dir = osync_objtype_sink_get_userdata(sink); + MockDir *dir = data; if (mock_get_error(info->memberid, "CONNECT_DONE_ERROR")) { osync_context_report_error(ctx, OSYNC_ERROR_EXPECTED, "Triggering CONNECT_DONE_ERROR error"); @@ -127,29 +127,45 @@ osync_trace(TRACE_EXIT, "%s", __func__); } - -static void mock_disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) +static void mock_mainsink_disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, data); - MockDir *dir = osync_objtype_sink_get_userdata(sink); mock_env *env = data; - - if (!dir) { - GList *o = env->directories; - for (; o; o = o->next) { - MockDir *sink_dir = o->data; - if (!g_getenv("NO_COMMITTED_ALL_CHECK")) - osync_assert(sink_dir->committed_all == TRUE); - - sink_dir->committed_all = FALSE; - } - } else { + + osync_assert(data); + + GList *o = env->directories; + for (; o; o = o->next) { + MockDir *sink_dir = o->data; if (!g_getenv("NO_COMMITTED_ALL_CHECK")) - osync_assert(dir->committed_all == TRUE); + osync_assert(sink_dir->committed_all == TRUE); + sink_dir->committed_all = FALSE; + } - dir->committed_all = FALSE; + if (mock_get_error(info->memberid, "DISCONNECT_ERROR")) { + osync_context_report_error(ctx, OSYNC_ERROR_EXPECTED, "Triggering DISCONNECT_ERROR error"); + return; } + if (mock_get_error(info->memberid, "DISCONNECT_TIMEOUT")) + return; + + osync_context_report_success(ctx); + + osync_trace(TRACE_EXIT, "%s", __func__); +} + +static void mock_disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) +{ + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, data); + + MockDir *dir = data; + + osync_assert(dir); + + if (!g_getenv("NO_COMMITTED_ALL_CHECK")) + osync_assert(dir->committed_all == TRUE); + dir->committed_all = FALSE; if (mock_get_error(info->memberid, "DISCONNECT_ERROR")) { @@ -172,7 +188,7 @@ static osync_bool mock_read(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, data); - MockDir *dir = osync_objtype_sink_get_userdata(sink); + MockDir *dir = data; OSyncError *error = NULL; char *filename = g_strdup_printf("%s/%s", dir->path, osync_change_get_uid(change)); @@ -210,7 +226,7 @@ static osync_bool mock_write(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, data); - MockDir *dir = osync_objtype_sink_get_userdata(sink); + MockDir *dir = data; OSyncError *error = NULL; OSyncData *odata = NULL; char *buffer = NULL; @@ -364,7 +380,7 @@ static void mock_get_changes(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %i, %p)", __func__, sink, info, ctx, slow_sync, data); - MockDir *dir = osync_objtype_sink_get_userdata(sink); + MockDir *dir = data; OSyncError *error = NULL; osync_assert(dir->committed_all == TRUE); @@ -427,7 +443,7 @@ static void mock_commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, data); - MockDir *dir = osync_objtype_sink_get_userdata(sink); + MockDir *dir = data; char *filename = NULL; @@ -470,7 +486,7 @@ static void mock_batch_commit(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *context, OSyncContext **contexts, OSyncChange **changes, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p, %p)", __func__, sink, info, context, contexts, changes, data); - MockDir *dir = osync_objtype_sink_get_userdata(sink); + MockDir *dir = data; osync_assert(dir->committed_all == FALSE); dir->committed_all = TRUE; @@ -512,7 +528,7 @@ static void mock_committed_all(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *context, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, context, data); - MockDir *dir = osync_objtype_sink_get_userdata(sink); + MockDir *dir = data; osync_assert(dir->committed_all == FALSE); dir->committed_all = TRUE; @@ -532,7 +548,7 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, data); OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - MockDir *dir = osync_objtype_sink_get_userdata(sink); + MockDir *dir = data; if (mock_get_error(info->memberid, "SYNC_DONE_ERROR")) { osync_context_report_error(ctx, OSYNC_ERROR_EXPECTED, "Triggering SYNC_DONE_ERROR error"); @@ -582,9 +598,9 @@ memset(&functions, 0, sizeof(functions)); functions.connect = mock_connect; - functions.disconnect = mock_disconnect; + functions.disconnect = mock_mainsink_disconnect; - osync_objtype_sink_set_functions(env->mainsink, functions, NULL); + osync_objtype_sink_set_functions(env->mainsink, functions, env); osync_plugin_info_set_main_sink(info, env->mainsink); } Modified: trunk/wrapper/opensync-plugin.i ============================================================================== --- trunk/wrapper/opensync-plugin.i Wed Feb 25 21:54:21 2009 (r5276) +++ trunk/wrapper/opensync-plugin.i Thu Feb 26 09:02:23 2009 (r5277) @@ -331,10 +331,12 @@ } ~ObjTypeSink() { + /* FIXME free userdata PyObject *callback_obj = osync_objtype_sink_get_userdata(self); if (callback_obj) { Py_DECREF(callback_obj); } + */ osync_objtype_sink_unref(self); } @@ -354,11 +356,11 @@ return osync_objtype_sink_nth_objformat_sink(self, nth); } - ObjFormatSink *find_objformat(ObjFormat *objformat) { - return osync_objtype_sink_find_objformat_sink(self, objformat); - } + ObjFormatSink *find_objformat(ObjFormat *objformat) { + return osync_objtype_sink_find_objformat_sink(self, objformat); + } - /* TODO: osync_objtype_sink_get_objformat_sinks with OSyncList */ + /* TODO: osync_objtype_sink_get_objformat_sinks with OSyncList */ void add_objformat(ObjFormatSink *format_sink) { osync_objtype_sink_add_objformat_sink(self, format_sink); @@ -370,14 +372,18 @@ /* TODO: set_functions */ + /* void *get_userdata() { return osync_objtype_sink_get_userdata(self); } + /* as above, but return it as a PyObject * for python code */ + /* PyObject *get_callback_obj() { return osync_objtype_sink_get_userdata(self); } + */ void get_changes(void *plugindata, PluginInfo *info, Context *ctx) { osync_objtype_sink_get_changes(self, plugindata, info, ctx); |
From: <svn...@op...> - 2009-02-25 20:54:34
|
Author: friedrich.beckmann Date: Wed Feb 25 21:54:21 2009 New Revision: 5276 URL: http://www.opensync.org/changeset/5276 Log: changed indentation replaced space with tabs Modified: trunk/tests/sync-tests/check_sync.c Modified: trunk/tests/sync-tests/check_sync.c ============================================================================== --- trunk/tests/sync-tests/check_sync.c Wed Feb 25 21:47:04 2009 (r5275) +++ trunk/tests/sync-tests/check_sync.c Wed Feb 25 21:54:21 2009 (r5276) @@ -145,19 +145,19 @@ g_free(path); check_mapping(maptable, 1, 1, 2, "testdata"); check_mapping(maptable, 2, 1, 2, "testdata"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); g_free(formatdir); @@ -213,19 +213,19 @@ g_free(path); check_mapping(maptable, 1, 1, 2, "testdata"); check_mapping(maptable, 2, 1, 2, "testdata"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); reset_counters(); @@ -279,16 +279,16 @@ path = g_strdup_printf("%s/configs/group/archive.db", testbed); maptable = mappingtable_load(path, "mockobjtype1", 0); g_free(path); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); @@ -389,19 +389,19 @@ g_free(path); check_mapping(maptable, 1, 1, 2, "testdata"); check_mapping(maptable, 2, 1, 2, "testdata"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); g_free(formatdir); @@ -493,19 +493,19 @@ g_free(path); check_mapping(maptable, 1, 1, 2, "testdata"); check_mapping(maptable, 2, 1, 2, "testdata"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); reset_counters(); @@ -559,16 +559,16 @@ path = g_strdup_printf("%s/configs/group/archive.db", testbed); maptable = mappingtable_load(path, "mockobjtype1", 0); g_free(path); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); @@ -663,21 +663,21 @@ check_mapping(maptable, 1, -1, 2, "testdata-dupe"); check_mapping(maptable, 2, -1, 2, "testdata"); check_mapping(maptable, 1, -1, 2, "testdata-dupe"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 2); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 2); g_free(path); - check_hash(table, "testdata"); - check_hash(table, "testdata-dupe"); + check_hash(table, "testdata"); + check_hash(table, "testdata-dupe"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 2); + table = hashtable_load(path, "mockobjtype1", 2); g_free(path); - check_hash(table, "testdata"); - check_hash(table, "testdata-dupe"); + check_hash(table, "testdata"); + check_hash(table, "testdata-dupe"); osync_hashtable_unref(table); fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" = \"x\""), NULL); @@ -735,19 +735,19 @@ g_free(path); check_mapping(maptable, 1, -1, 2, "testdata"); check_mapping(maptable, 2, -1, 2, "testdata"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); g_free(formatdir); @@ -846,29 +846,29 @@ char *path = g_strdup_printf("%s/configs/group/archive.db", testbed); OSyncMappingTable *maptable = mappingtable_load(path, "mockobjtype1", 0); g_free(path); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); - /* Don't care about the hashtable. The engine got aborted - this MUST and WILL - cause a slow-sync next time. A slow-sync ends up in flushing the persistent - hashtable. */ - - /* - path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); - g_free(path); - check_hash(table, "testdata"); - // check_hash(table, "testdata-dupe"); - osync_hashtable_unref(table); - - path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); - g_free(path); - check_hash(table, "testdata"); - // check_hash(table, "testdata-dupe"); - osync_hashtable_unref(table); -*/ + /* Don't care about the hashtable. The engine got aborted - this MUST and WILL + cause a slow-sync next time. A slow-sync ends up in flushing the persistent + hashtable. */ + + /* + path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); + g_free(path); + check_hash(table, "testdata"); + // check_hash(table, "testdata-dupe"); + osync_hashtable_unref(table); + + path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); + table = hashtable_load(path, "mockobjtype1", 1); + g_free(path); + check_hash(table, "testdata"); + // check_hash(table, "testdata-dupe"); + osync_hashtable_unref(table); + */ fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); // osync_testing_system_abort("rm -f data1/testdata-dupe"); @@ -924,26 +924,26 @@ path = g_strdup_printf("%s/configs/group/archive.db", testbed); maptable = mappingtable_load(path, "mockobjtype1", 0); g_free(path); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); - /* Don't care about the hashtable. The engine got aborted - this MUST and WILL - cause a slow-sync next time. A slow-sync ends up in flushing the persistent - hashtable. */ - - /* - path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); - g_free(path); - check_hash(table, "testdata"); - osync_hashtable_unref(table); - - path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); - g_free(path); - check_hash(table, "testdata"); - osync_hashtable_unref(table); - */ + /* Don't care about the hashtable. The engine got aborted - this MUST and WILL + cause a slow-sync next time. A slow-sync ends up in flushing the persistent + hashtable. */ + + /* + path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); + table = hashtable_load(path, "mockobjtype1", 1); + g_free(path); + check_hash(table, "testdata"); + osync_hashtable_unref(table); + + path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); + table = hashtable_load(path, "mockobjtype1", 1); + g_free(path); + check_hash(table, "testdata"); + osync_hashtable_unref(table); + */ g_free(formatdir); g_free(plugindir); @@ -981,18 +981,18 @@ check_mapping(maptable, 2, -1, 2, "testdata"); check_mapping(maptable, 2, -1, 2, "testdata-dupe"); check_mapping(maptable, 2, -1, 2, "testdata-dupe-dupe"); - mappingtable_close(maptable); + mappingtable_close(maptable); OSyncHashTable *table = hashtable_load(group, 1, 3); - check_hash(table, "testdata"); - check_hash(table, "testdata-dupe"); - check_hash(table, "testdata-dupe-dupe"); + check_hash(table, "testdata"); + check_hash(table, "testdata-dupe"); + check_hash(table, "testdata-dupe-dupe"); osync_hashtable_close(table); table = hashtable_load(group, 2, 3); - check_hash(table, "testdata"); - check_hash(table, "testdata-dupe"); - check_hash(table, "testdata-dupe-dupe"); + check_hash(table, "testdata"); + check_hash(table, "testdata-dupe"); + check_hash(table, "testdata-dupe-dupe"); osync_hashtable_close(table); fail_unless(!system("rm -f data1/testdata-dupe data2/testdata-dupe-dupe"), NULL); @@ -1006,14 +1006,14 @@ maptable = mappingtable_load(group, 1, 0); check_mapping(maptable, 1, 0, 2, "testdata"); check_mapping(maptable, 2, 0, 2, "testdata"); - mappingtable_close(maptable); + mappingtable_close(maptable); table = hashtable_load(group, 1, 1); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_close(table); table = hashtable_load(group, 2, 1); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_close(table); g_free(formatdir); @@ -1109,21 +1109,21 @@ check_mapping(maptable, 1, -1, 2, "testdata-dupe"); check_mapping(maptable, 2, -1, 2, "testdata"); check_mapping(maptable, 1, -1, 2, "testdata-dupe"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 2); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 2); g_free(path); - check_hash(table, "testdata"); - check_hash(table, "testdata-dupe"); + check_hash(table, "testdata"); + check_hash(table, "testdata-dupe"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 2); + table = hashtable_load(path, "mockobjtype1", 2); g_free(path); - check_hash(table, "testdata"); - check_hash(table, "testdata-dupe"); + check_hash(table, "testdata"); + check_hash(table, "testdata-dupe"); osync_hashtable_unref(table); @@ -1185,19 +1185,19 @@ g_free(path); check_mapping(maptable, 1, -1, 2, "testdata"); check_mapping(maptable, 2, -1, 2, "testdata"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); g_free(formatdir); @@ -1298,23 +1298,23 @@ check_mapping(maptable, 2, -1, 2, "testdata2"); check_mapping(maptable, 1, -1, 2, "testdata3"); check_mapping(maptable, 2, -1, 2, "testdata3"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 3); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 3); g_free(path); - check_hash(table, "testdata1"); - check_hash(table, "testdata2"); - check_hash(table, "testdata3"); + check_hash(table, "testdata1"); + check_hash(table, "testdata2"); + check_hash(table, "testdata3"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 3); + table = hashtable_load(path, "mockobjtype1", 3); g_free(path); - check_hash(table, "testdata1"); - check_hash(table, "testdata2"); - check_hash(table, "testdata3"); + check_hash(table, "testdata1"); + check_hash(table, "testdata2"); + check_hash(table, "testdata3"); osync_hashtable_unref(table); osync_testing_system_abort("rm -f data1/testdata1"); @@ -1370,16 +1370,16 @@ path = g_strdup_printf("%s/configs/group/archive.db", testbed); maptable = mappingtable_load(path, "mockobjtype1", 0); g_free(path); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); @@ -1482,16 +1482,16 @@ char *path = g_strdup_printf("%s/configs/group/archive.db", testbed); OSyncMappingTable *maptable = mappingtable_load(path, "mockobjtype1", 0); g_free(path); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 0); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); @@ -1593,19 +1593,19 @@ g_free(path); check_mapping(maptable, 1, 1, 2, "testdata"); check_mapping(maptable, 2, 1, 2, "testdata"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); reset_counters(); @@ -1659,16 +1659,16 @@ path = g_strdup_printf("%s/configs/group/archive.db", testbed); maptable = mappingtable_load(path, "mockobjtype1", 0); g_free(path); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); @@ -1773,16 +1773,16 @@ char *path = g_strdup_printf("%s/configs/group/archive.db", testbed); OSyncMappingTable *maptable = mappingtable_load(path, "mockobjtype1", 0); g_free(path); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 0); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); @@ -1881,21 +1881,21 @@ check_mapping(maptable, 2, -1, 2, "testdata"); check_mapping(maptable, 1, -1, 2, "testdata"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 2); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 2); g_free(path); - check_hash(table, "testdata"); - check_hash(table, "testdata2"); + check_hash(table, "testdata"); + check_hash(table, "testdata2"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 2); + table = hashtable_load(path, "mockobjtype1", 2); g_free(path); - check_hash(table, "testdata"); - check_hash(table, "testdata2"); + check_hash(table, "testdata"); + check_hash(table, "testdata2"); osync_hashtable_unref(table); reset_counters(); @@ -1951,16 +1951,16 @@ path = g_strdup_printf("%s/configs/group/archive.db", testbed); maptable = mappingtable_load(path, "mockobjtype1", 0); g_free(path); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); @@ -2086,37 +2086,37 @@ check_mapping(maptable, 2, -1, 2, "file9"); check_mapping(maptable, 1, -1, 2, "file10"); check_mapping(maptable, 2, -1, 2, "file10"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 10); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 10); g_free(path); - check_hash(table, "file1"); - check_hash(table, "file2"); - check_hash(table, "file3"); - check_hash(table, "file4"); - check_hash(table, "file5"); - check_hash(table, "file6"); - check_hash(table, "file7"); - check_hash(table, "file8"); - check_hash(table, "file9"); - check_hash(table, "file10"); + check_hash(table, "file1"); + check_hash(table, "file2"); + check_hash(table, "file3"); + check_hash(table, "file4"); + check_hash(table, "file5"); + check_hash(table, "file6"); + check_hash(table, "file7"); + check_hash(table, "file8"); + check_hash(table, "file9"); + check_hash(table, "file10"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 10); - g_free(path); - check_hash(table, "file1"); - check_hash(table, "file2"); - check_hash(table, "file3"); - check_hash(table, "file4"); - check_hash(table, "file5"); - check_hash(table, "file6"); - check_hash(table, "file7"); - check_hash(table, "file8"); - check_hash(table, "file9"); - check_hash(table, "file10"); + table = hashtable_load(path, "mockobjtype1", 10); + g_free(path); + check_hash(table, "file1"); + check_hash(table, "file2"); + check_hash(table, "file3"); + check_hash(table, "file4"); + check_hash(table, "file5"); + check_hash(table, "file6"); + check_hash(table, "file7"); + check_hash(table, "file8"); + check_hash(table, "file9"); + check_hash(table, "file10"); osync_hashtable_unref(table); reset_counters(); @@ -2219,37 +2219,37 @@ check_mapping(maptable, 2, -1, 2, "file13"); check_mapping(maptable, 1, -1, 2, "file14"); check_mapping(maptable, 2, -1, 2, "file14"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 10); + table = hashtable_load(path, "mockobjtype1", 10); g_free(path); - check_hash(table, "file1"); - check_hash(table, "file2"); - check_hash(table, "file5"); - check_hash(table, "file6"); - check_hash(table, "file9"); - check_hash(table, "file10"); - check_hash(table, "file11"); - check_hash(table, "file12"); - check_hash(table, "file13"); - check_hash(table, "file14"); + check_hash(table, "file1"); + check_hash(table, "file2"); + check_hash(table, "file5"); + check_hash(table, "file6"); + check_hash(table, "file9"); + check_hash(table, "file10"); + check_hash(table, "file11"); + check_hash(table, "file12"); + check_hash(table, "file13"); + check_hash(table, "file14"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 10); - g_free(path); - check_hash(table, "file1"); - check_hash(table, "file2"); - check_hash(table, "file5"); - check_hash(table, "file6"); - check_hash(table, "file9"); - check_hash(table, "file10"); - check_hash(table, "file11"); - check_hash(table, "file12"); - check_hash(table, "file13"); - check_hash(table, "file14"); + table = hashtable_load(path, "mockobjtype1", 10); + g_free(path); + check_hash(table, "file1"); + check_hash(table, "file2"); + check_hash(table, "file5"); + check_hash(table, "file6"); + check_hash(table, "file9"); + check_hash(table, "file10"); + check_hash(table, "file11"); + check_hash(table, "file12"); + check_hash(table, "file13"); + check_hash(table, "file14"); osync_hashtable_unref(table); @@ -2320,16 +2320,16 @@ path = g_strdup_printf("%s/configs/group/archive.db", testbed); maptable = mappingtable_load(path, "mockobjtype1", 0); g_free(path); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 0); + table = hashtable_load(path, "mockobjtype1", 0); g_free(path); osync_hashtable_unref(table); @@ -2752,19 +2752,19 @@ g_free(path); check_mapping(maptable, 1, -1, 2, "file1"); check_mapping(maptable, 2, -1, 2, "file1"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "file1"); + check_hash(table, "file1"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "file1"); + check_hash(table, "file1"); osync_hashtable_unref(table); g_free(formatdir); @@ -2863,19 +2863,19 @@ g_free(path); check_mapping(maptable, 1, 1, 2, "testdata"); check_mapping(maptable, 2, 1, 2, "testdata"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); /* 2nd Sync with new path config for #1 member - this is needed @@ -2961,19 +2961,19 @@ g_free(path); check_mapping(maptable, 1, 1, 2, "testdata"); check_mapping(maptable, 2, 1, 2, "testdata"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); g_free(formatdir); @@ -3075,19 +3075,19 @@ g_free(path); check_mapping(maptable, 1, 1, 2, "testdata"); check_mapping(maptable, 2, 1, 2, "testdata"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); /* 2nd Sync trigger a SlowSync within the MAINSINK connect function. */ @@ -3172,19 +3172,19 @@ g_free(path); check_mapping(maptable, 1, 1, 2, "testdata"); check_mapping(maptable, 2, 1, 2, "testdata"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); g_free(formatdir); @@ -3437,19 +3437,19 @@ g_free(path); check_mapping(maptable, 1, 1, 2, "testdata"); check_mapping(maptable, 2, 1, 2, "testdata"); - osync_mapping_table_close(maptable); - osync_mapping_table_unref(maptable); + osync_mapping_table_close(maptable); + osync_mapping_table_unref(maptable); path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); - OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); + OSyncHashTable *table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); - table = hashtable_load(path, "mockobjtype1", 1); + table = hashtable_load(path, "mockobjtype1", 1); g_free(path); - check_hash(table, "testdata"); + check_hash(table, "testdata"); osync_hashtable_unref(table); g_free(formatdir); @@ -3460,7 +3460,7 @@ END_TEST OSYNC_TESTCASE_START("sync") -OSYNC_TESTCASE_ADD(sync_setup_connect) + OSYNC_TESTCASE_ADD(sync_setup_connect) OSYNC_TESTCASE_ADD(sync_easy_new) OSYNC_TESTCASE_ADD(sync_easy_new_del) OSYNC_TESTCASE_ADD(sync_easy_conflict) |
From: <svn...@op...> - 2009-02-25 20:47:16
|
Author: friedrich.beckmann Date: Wed Feb 25 21:47:04 2009 New Revision: 5275 URL: http://www.opensync.org/changeset/5275 Log: test lock_dual_sync_engine_unclean does not work as expected - see ticket 1066 - disabled the test Modified: trunk/tests/CMakeLists.txt Modified: trunk/tests/CMakeLists.txt ============================================================================== --- trunk/tests/CMakeLists.txt Wed Feb 25 17:23:43 2009 (r5274) +++ trunk/tests/CMakeLists.txt Wed Feb 25 21:47:04 2009 (r5275) @@ -226,7 +226,7 @@ OSYNC_TESTCASE(lock lock_dual_lock) OSYNC_TESTCASE(lock lock_dual_lock2) OSYNC_TESTCASE(lock lock_dual_sync_engine_lock) -OSYNC_TESTCASE(lock lock_dual_sync_engine_unclean) +OSYNC_TESTCASE_DISABLED(lock lock_dual_sync_engine_unclean "1066" ) IF (NOT WIN32) BUILD_CHECK_TEST( ipc ipc-tests/check_ipc.c ${TEST_TARGET_LIBRARIES} ) |
From: <svn...@op...> - 2009-02-25 16:23:51
|
Author: friedrich.beckmann Date: Wed Feb 25 17:23:43 2009 New Revision: 5274 URL: http://www.opensync.org/changeset/5274 Log: windows port - engine tests and multisync tests did not run on windows. Mainly because the test command is not available in the msys environment. Modified: trunk/tests/engine-tests/check_engine_error.c trunk/tests/support.c trunk/tests/support.h trunk/tests/sync-tests/check_multisync.c Modified: trunk/tests/engine-tests/check_engine_error.c ============================================================================== --- trunk/tests/engine-tests/check_engine_error.c Wed Feb 25 14:58:27 2009 (r5273) +++ trunk/tests/engine-tests/check_engine_error.c Wed Feb 25 17:23:43 2009 (r5274) @@ -433,7 +433,8 @@ fail_unless(!synchronize_once(engine, &error), NULL); fail_unless(error != NULL, NULL); osync_error_unref(&error); - + + fail_unless(osync_engine_finalize(engine, &error), NULL); osync_engine_unref(engine); osync_group_unref(group); g_free(formatdir); @@ -576,12 +577,12 @@ fail_unless(num_engine_errors == 1, NULL); osync_error_unref(&error); - - osync_engine_unref(engine); + fail_unless(osync_engine_finalize(engine, &error), NULL); + osync_engine_unref(engine); osync_group_unref(group); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -635,7 +636,7 @@ osync_engine_finalize(engine, &error); osync_engine_unref(engine); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -687,9 +688,8 @@ osync_error_unref(&error); osync_engine_finalize(engine, &error); osync_engine_unref(engine); - - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -741,7 +741,7 @@ osync_engine_finalize(engine, &error); osync_engine_unref(engine); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -794,7 +794,7 @@ fail_unless(num_engine_errors == 1, NULL); fail_unless(num_client_disconnected == 2, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -908,7 +908,7 @@ fail_unless(num_engine_errors == 1, NULL); fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -967,7 +967,7 @@ fail_unless(num_engine_errors == 1, "Number of Engine Errors: %u Expected: 1", num_engine_errors); fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -1023,7 +1023,7 @@ fail_unless(num_engine_errors == 1, NULL); fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -1080,7 +1080,7 @@ fail_unless(num_engine_errors == 1, NULL); fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -1138,7 +1138,7 @@ fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -1198,7 +1198,7 @@ fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -1256,7 +1256,7 @@ fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -1314,7 +1314,7 @@ fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -1375,7 +1375,7 @@ fail_unless(num_engine_errors == 1, NULL); fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -1437,7 +1437,7 @@ fail_unless(num_engine_errors == 1, NULL); fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -1506,7 +1506,7 @@ fail_unless(num_engine_errors == 1, NULL); fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); g_free(formatdir); g_free(plugindir); @@ -1571,7 +1571,7 @@ fail_unless(num_engine_successful == 0, NULL); fail_unless(osync_testing_diff("data1", "data2")); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data3)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data3")); g_free(formatdir); g_free(plugindir); @@ -1631,8 +1631,8 @@ fail_unless(num_engine_errors == 1, NULL); fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data3)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); + fail_unless(!osync_testing_diff("data1", "data3")); g_free(formatdir); g_free(plugindir); @@ -1695,7 +1695,7 @@ fail_unless(num_engine_successful == 0, NULL); fail_unless(osync_testing_diff("data1", "data2")); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data3)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data3")); g_free(formatdir); g_free(plugindir); @@ -1757,8 +1757,8 @@ fail_unless(num_engine_errors == 1, NULL); fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data3)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); + fail_unless(!osync_testing_diff("data1", "data3")); g_free(formatdir); g_free(plugindir); @@ -1821,8 +1821,8 @@ fail_unless(num_engine_errors == 1, NULL); fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data3)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); + fail_unless(!osync_testing_diff("data1", "data3")); g_free(formatdir); g_free(plugindir); @@ -1885,8 +1885,8 @@ fail_unless(num_engine_errors == 1, NULL); fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data3)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); + fail_unless(!osync_testing_diff("data1", "data3")); g_free(formatdir); g_free(plugindir); @@ -1958,8 +1958,8 @@ fail_unless(num_engine_errors == 1, NULL); fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data3)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); + fail_unless(!osync_testing_diff("data1", "data3")); fail_unless(osync_testing_diff("data2", "data3")); g_free(formatdir); @@ -2032,8 +2032,8 @@ fail_unless(num_engine_errors == 1, NULL); fail_unless(num_engine_successful == 0, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data3)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); + fail_unless(!osync_testing_diff("data1", "data3")); fail_unless(osync_testing_diff("data2", "data3")); g_free(formatdir); @@ -2956,8 +2956,8 @@ osync_engine_finalize(engine, &error); osync_engine_unref(engine); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" != \"x\""), NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data3)\" != \"x\""), NULL); + fail_unless(!osync_testing_diff("data1", "data2")); + fail_unless(!osync_testing_diff("data1", "data3")); g_free(formatdir); g_free(plugindir); Modified: trunk/tests/support.c ============================================================================== --- trunk/tests/support.c Wed Feb 25 14:58:27 2009 (r5273) +++ trunk/tests/support.c Wed Feb 25 17:23:43 2009 (r5274) @@ -771,6 +771,18 @@ return !ret; } +/** + * @brief Test if the directory is empty + */ +osync_bool osync_testing_directory_is_empty(const char *dirname) +{ + gchar *cmd; + int ret; + cmd = g_strdup_printf("ls %s | grep \".*\"", dirname); + ret = system(cmd); + return (ret != 0); +} + /** @brief Creates a simple OSyncPluginConfig with a single resource. * If config is not null the resource information gets added. * Modified: trunk/tests/support.h ============================================================================== --- trunk/tests/support.h Wed Feb 25 14:58:27 2009 (r5273) +++ trunk/tests/support.h Wed Feb 25 17:23:43 2009 (r5274) @@ -130,6 +130,7 @@ osync_bool osync_testing_file_chmod(const char *file, int mode); osync_bool osync_testing_file_copy(const char *source, const char *dest); osync_bool osync_testing_diff(const char *file1, const char *file2); +osync_bool osync_testing_directory_is_empty(const char *dirname); /* Plugin config helper */ OSyncPluginConfig *simple_plugin_config(OSyncPluginConfig *config, const char *path, const char *objtype, const char *objformat, const char *format_config); Modified: trunk/tests/sync-tests/check_multisync.c ============================================================================== --- trunk/tests/sync-tests/check_multisync.c Wed Feb 25 14:58:27 2009 (r5273) +++ trunk/tests/sync-tests/check_multisync.c Wed Feb 25 17:23:43 2009 (r5274) @@ -43,8 +43,8 @@ osync_engine_unref(engine); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" = \"x\""), NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data3)\" = \"x\""), NULL); + fail_unless(osync_testing_diff("data1", "data2")); + fail_unless(osync_testing_diff("data1", "data3")); /* Client checks */ fail_unless(num_client_connected == 3, NULL); @@ -146,8 +146,8 @@ fail_unless(osync_engine_synchronize_and_block(engine, &error), NULL); fail_unless(error == NULL, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" = \"x\""), NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data3)\" = \"x\""), NULL); + fail_unless(osync_testing_diff("data1", "data2")); + fail_unless(osync_testing_diff("data1", "data3")); /* Client checks */ fail_unless(num_client_connected == 3, NULL); @@ -221,19 +221,22 @@ path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); table = hashtable_load(path, "mockobjtype1", 0); + osync_hashtable_unref(table); g_free(path); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); table = hashtable_load(path, "mockobjtype1", 0); + osync_hashtable_unref(table); g_free(path); path = g_strdup_printf("%s/configs/group/3/hashtable.db", testbed); table = hashtable_load(path, "mockobjtype1", 0); + osync_hashtable_unref(table); g_free(path); - fail_unless(!system("test \"x$(ls data1)\" = \"x\""), NULL); - fail_unless(!system("test \"x$(ls data2)\" = \"x\""), NULL); - fail_unless(!system("test \"x$(ls data3)\" = \"x\""), NULL); + fail_unless(osync_testing_directory_is_empty("data1"), NULL); + fail_unless(osync_testing_directory_is_empty("data2"), NULL); + fail_unless(osync_testing_directory_is_empty("data3"), NULL); destroy_testbed(testbed); } @@ -278,8 +281,8 @@ fail_unless(osync_engine_synchronize_and_block(engine, &error), NULL); fail_unless(error == NULL, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" = \"x\""), NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data3)\" = \"x\""), NULL); + fail_unless(osync_testing_diff("data1", "data2")); + fail_unless(osync_testing_diff("data1", "data3")); /* Client checks */ fail_unless(num_client_connected == 3, NULL); @@ -353,20 +356,23 @@ path = g_strdup_printf("%s/configs/group/1/hashtable.db", testbed); table = hashtable_load(path, "mockobjtype1", 0); + osync_hashtable_unref(table); g_free(path); path = g_strdup_printf("%s/configs/group/2/hashtable.db", testbed); table = hashtable_load(path, "mockobjtype1", 0); + osync_hashtable_unref(table); g_free(path); path = g_strdup_printf("%s/configs/group/3/hashtable.db", testbed); table = hashtable_load(path, "mockobjtype1", 0); + osync_hashtable_unref(table); g_free(path); - fail_unless(!system("test \"x$(ls data1)\" = \"x\""), NULL); - fail_unless(!system("test \"x$(ls data2)\" = \"x\""), NULL); - fail_unless(!system("test \"x$(ls data3)\" = \"x\""), NULL); - + fail_unless(osync_testing_directory_is_empty("data1"), NULL); + fail_unless(osync_testing_directory_is_empty("data2"), NULL); + fail_unless(osync_testing_directory_is_empty("data3"), NULL); + destroy_testbed(testbed); } @@ -388,8 +394,8 @@ synchronize_once(engine, NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data2)\" = \"x\""), NULL); - fail_unless(!system("test \"x$(diff -x \".*\" data1 data3)\" = \"x\""), NULL); + fail_unless(osync_testing_diff("data1", "data2")); + fail_unless(osync_testing_diff("data1", "data3")); fail_unless(num_written == 2, NULL); fail_unless(num_read == 1, NULL); |
From: <svn...@op...> - 2009-02-25 15:53:42
|
Author: bellmich Date: Wed Feb 25 16:53:34 2009 New Revision: 957 URL: http://libsyncml.opensync.org/changeset/957 Log: avoid more than one initialization of libxml Modified: trunk/tests/check_devinf.c trunk/tests/check_manager.c Modified: trunk/tests/check_devinf.c ============================================================================== --- trunk/tests/check_devinf.c Wed Feb 25 16:26:12 2009 (r956) +++ trunk/tests/check_devinf.c Wed Feb 25 16:53:34 2009 (r957) @@ -215,7 +215,6 @@ session_errors = 0; setup_testbed(NULL); - g_type_init(); SmlError *error = NULL; SmlTransport *server = smlTransportNew(SML_TRANSPORT_HTTP_SERVER, &error); @@ -415,6 +414,8 @@ { configure_environment(); + smlLibxmlRef(); + int nf; Suite *s = devinf_suite(); @@ -424,5 +425,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + smlLibxmlUnref(); + return (nf == 0) ? 0 : 1; } Modified: trunk/tests/check_manager.c ============================================================================== --- trunk/tests/check_manager.c Wed Feb 25 16:26:12 2009 (r956) +++ trunk/tests/check_manager.c Wed Feb 25 16:53:34 2009 (r957) @@ -686,6 +686,8 @@ { configure_environment(); + smlLibxmlRef(); + int nf; Suite *s = manager_suite(); @@ -695,5 +697,8 @@ srunner_run_all(sr, CK_VERBOSE); nf = srunner_ntests_failed(sr); srunner_free(sr); + + smlLibxmlUnref(); + return (nf == 0) ? 0 : 1; } |
From: <svn...@op...> - 2009-02-25 15:26:18
|
Author: bellmich Date: Wed Feb 25 16:26:12 2009 New Revision: 956 URL: http://libsyncml.opensync.org/changeset/956 Log: fixed wrong trace statement Modified: trunk/tests/mobiles/obex_mobile_ds_client.c Modified: trunk/tests/mobiles/obex_mobile_ds_client.c ============================================================================== --- trunk/tests/mobiles/obex_mobile_ds_client.c Wed Feb 25 16:25:49 2009 (r955) +++ trunk/tests/mobiles/obex_mobile_ds_client.c Wed Feb 25 16:26:12 2009 (r956) @@ -124,7 +124,7 @@ result = g_regex_replace_literal(regex, original, strlen(original), 0, replacement, 0, &error); - sml_fail_unless(result != NULL, "Cannot filter \"%s\" from message."); + sml_fail_unless(result != NULL, "Cannot filter \"%s\" from message.", expr); smlSafeCFree(&original); g_regex_unref(regex); |
From: <svn...@op...> - 2009-02-25 15:25:57
|
Author: bellmich Date: Wed Feb 25 16:25:49 2009 New Revision: 955 URL: http://libsyncml.opensync.org/changeset/955 Log: The number of leaks with relations to libxml should be dramatically reduced. Modified: trunk/tests/valgrind.supp Modified: trunk/tests/valgrind.supp ============================================================================== --- trunk/tests/valgrind.supp Wed Feb 25 16:24:52 2009 (r954) +++ trunk/tests/valgrind.supp Wed Feb 25 16:25:49 2009 (r955) @@ -11,96 +11,6 @@ fun:wbxml_tree_clb_xml_end_element } -##################### -## libxml2 ## -##################### - -## xmlReaderForMemory - -{ - xmlReaderForMemory - source: smlXmlParserStart - 1 - Memcheck:Leak - fun:malloc - fun:xmlStrndup - fun:xmlStrdup - fun:xmlNewCharEncodingHandler - fun:xmlInitCharEncodingHandlers - fun:xmlGetCharEncodingHandler - fun:xmlParserInputBufferCreateStatic - fun:xmlReaderForMemory -} - -{ - xmlReaderForMemory - source: smlXmlParserStart - 2 - Memcheck:Leak - fun:malloc - fun:xmlNewRMutex - obj:* - fun:xmlDictCreate - fun:xmlInitParserCtxt - fun:xmlNewParserCtxt - fun:xmlCreatePushParserCtxt - fun:xmlNewTextReader - fun:xmlReaderForMemory -} - -{ - xmlReaderForMemory - source: smlXmlParserStart - 3 - Memcheck:Leak - fun:malloc - fun:xmlNewCharEncodingHandler - fun:xmlInitCharEncodingHandlers - fun:xmlGetCharEncodingHandler - fun:xmlParserInputBufferCreateStatic - fun:xmlReaderForMemory -} - -{ - xmlReaderForMemory - source: smlXmlParserStart - 4 - Memcheck:Leak - fun:malloc - fun:xmlInitCharEncodingHandlers - fun:xmlGetCharEncodingHandler - fun:xmlParserInputBufferCreateStatic - fun:xmlReaderForMemory -} - -{ - xmlReaderForMemory - source: smlXmlParserStart - 5 - Memcheck:Leak - fun:malloc - fun:xmlNewRMutex - fun:xmlDictCreate - fun:xmlInitParserCtxt - fun:xmlNewParserCtxt - fun:xmlCreatePushParserCtxt - fun:xmlNewTextReader - fun:xmlReaderForMemory -} - -## xmlBufferCreateSize - -{ - xmlBufferCreateSize - 1 - Memcheck:Leak - fun:malloc - fun:xmlNewMutex - fun:xmlInitGlobals - fun:xmlInitializeGlobalState - fun:xmlGetGlobalState - fun:__xmlBufferAllocScheme - fun:xmlBufferCreateSize -} - -{ - xmlBufferCreateSize - 2 - Memcheck:Leak - fun:malloc - fun:xmlGetGlobalState - fun:__xmlBufferAllocScheme - fun:xmlBufferCreateSize -} - ################## ## glib ## ################## |
From: <svn...@op...> - 2009-02-25 15:24:58
|
Author: bellmich Date: Wed Feb 25 16:24:52 2009 New Revision: 954 URL: http://libsyncml.opensync.org/changeset/954 Log: Is glib-object.h really needed? Modified: trunk/libsyncml/syncml_internals.h Modified: trunk/libsyncml/syncml_internals.h ============================================================================== --- trunk/libsyncml/syncml_internals.h Wed Feb 25 16:24:29 2009 (r953) +++ trunk/libsyncml/syncml_internals.h Wed Feb 25 16:24:52 2009 (r954) @@ -42,7 +42,8 @@ #define _SYNCML_INTERNALS_H #include <glib.h> -#include <glib-object.h> +/* FIXME: Do we need this include? */ +/* #include <glib-object.h> */ #include <string.h> #include <glib/gprintf.h> #include <sys/stat.h> |
From: <svn...@op...> - 2009-02-25 15:24:35
|
Author: bellmich Date: Wed Feb 25 16:24:29 2009 New Revision: 953 URL: http://libsyncml.opensync.org/changeset/953 Log: If goto is used then this use should be reduced to one label. Modified: trunk/libsyncml/sml_notification.c Modified: trunk/libsyncml/sml_notification.c ============================================================================== --- trunk/libsyncml/sml_notification.c Wed Feb 25 16:23:18 2009 (r952) +++ trunk/libsyncml/sml_notification.c Wed Feb 25 16:24:29 2009 (r953) @@ -334,32 +334,35 @@ */ smlAssert(san->manager); + SmlAssembler *assm = NULL; + SmlLocation *source = NULL; + SmlSession *session = NULL; SmlSanAlert *alert = NULL; SmlCommand *cmd = NULL; - SmlAssembler *assm = smlAssemblerNew(san->type, 0, error); - if (!assm) - goto error; - - SmlLocation *source = smlLocationNew(san->identifier, NULL, error); + source = smlLocationNew(san->identifier, NULL, error); if (!source) - goto error_free_assm; + goto error; char *sessionString = smlManagerGetNewSessionID(san->manager); - SmlSession *session = smlSessionNew(san->sessionType, san->type, version, SML_PROTOCOL_SYNCML, san->target, source, sessionString, 0, error); + session = smlSessionNew(san->sessionType, san->type, version, SML_PROTOCOL_SYNCML, san->target, source, sessionString, 0, error); if (!session) { smlSafeCFree(&sessionString); smlLocationUnref(source); - goto error_free_assm; + goto error; } smlSafeCFree(&sessionString); smlManagerSessionAdd(san->manager, session, NULL, error); + assm = smlAssemblerNew(san->type, 0, error); + if (!assm) + goto error; + if (!smlAssemblerStart(assm, session, error)) - goto error_free_session; + goto error; if (!smlAssemblerAddHeader(assm, session, error)) - goto error_free_session; + goto error; GList *a = NULL; int i = 1; @@ -369,22 +372,22 @@ SmlLocation *loc = smlLocationNew(alert->serverURI, NULL, error); if (!loc) - goto error_free_session; + goto error; cmd = smlCommandNewAlert(SML_ALERT_TWO_WAY_BY_SERVER, NULL, loc, NULL, NULL, alert->contenttype, error); if (!cmd) { smlLocationUnref(loc); - goto error_free_session; + goto error; } cmd->cmdID = i; i++; if (!smlAssemblerStartCommand(assm, NULL, cmd, error) == SML_ASSEMBLER_RESULT_OK) - goto error_free_cmd; + goto error; if (!smlAssemblerEndCommand(assm, NULL, error)) - goto error_free_cmd; + goto error; smlLocationUnref(loc); @@ -392,7 +395,7 @@ } if (!smlAssemblerRun(assm, data, size, NULL, TRUE, error)) - goto error_free_session; + goto error; smlAssemblerFlush(assm); @@ -409,13 +412,13 @@ smlTrace(TRACE_EXIT, "%s", __func__); return TRUE; -error_free_cmd: - smlCommandUnref(cmd); -error_free_session: - smlSessionUnref(session); -error_free_assm: - smlAssemblerFree(assm); error: + if (cmd) + smlCommandUnref(cmd); + if (session) + smlSessionUnref(session); + if (assm) + smlAssemblerFree(assm); *data = NULL; *size = 0; smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); @@ -428,6 +431,7 @@ CHECK_ERROR_REF smlAssert(san); smlAssert(data); + smlAssert(*data == NULL); smlAssert(size); unsigned int numsync = 0; SmlSanAlert *alert = NULL; @@ -563,9 +567,9 @@ smlTrace(TRACE_EXIT, "%s", __func__); return TRUE; -error_free_data: - smlSafeCFree(data); error: + if (*data) + smlSafeCFree(data); *size = 0; smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); return FALSE; |
From: <svn...@op...> - 2009-02-25 15:23:25
|
Author: bellmich Date: Wed Feb 25 16:23:18 2009 New Revision: 952 URL: http://libsyncml.opensync.org/changeset/952 Log: added calls to smlLibxmlRef and smlLibxmlUnref to handle libxml init and cleanup Modified: trunk/libsyncml/parser/sml_xml_assm.c trunk/libsyncml/parser/sml_xml_parse.c Modified: trunk/libsyncml/parser/sml_xml_assm.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_assm.c Wed Feb 25 16:22:25 2009 (r951) +++ trunk/libsyncml/parser/sml_xml_assm.c Wed Feb 25 16:23:18 2009 (r952) @@ -1504,6 +1504,8 @@ g_mutex_free(assm->mutex); smlSafeFree((gpointer *)&assm); + smlLibxmlUnref(); + smlTrace(TRACE_EXIT, "%s", __func__); } @@ -1958,6 +1960,8 @@ functions->flush = (SmlAssemblerFlushFunction)smlXmlAssemblerFlush; functions->restore_cmds = (SmlAssemblerRestoreCommandsFunction)smlXmlAssemblerRestoreCommands; + smlLibxmlRef(); + smlTrace(TRACE_EXIT, "%s: %p", __func__, assm); return assm; @@ -2400,6 +2404,8 @@ if (version == SML_DEVINF_VERSION_UNKNOWN) version = devinf->version; smlAssert(devinf->version == version); + + smlLibxmlRef(); SmlXmlAssembler *assm = smlTryMalloc0(sizeof(SmlXmlAssembler), error); if (!assm) @@ -2553,6 +2559,8 @@ xmlBufferFree(buffer); smlSafeFree((gpointer *)&assm); + + smlLibxmlUnref(); smlTrace(TRACE_INTERNAL, "Message Assembled: %s", *data); @@ -2567,6 +2575,7 @@ error_free_assm: smlSafeFree((gpointer *)&assm); error: + smlLibxmlUnref(); g_warning("%s: %s", __func__, smlErrorPrint(error)); smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); return FALSE; Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Wed Feb 25 16:22:25 2009 (r951) +++ trunk/libsyncml/parser/sml_xml_parse.c Wed Feb 25 16:23:18 2009 (r952) @@ -1904,6 +1904,7 @@ parser->got_command = FALSE; /* Create the new parser */ + smlLibxmlRef(); parser->reader = xmlReaderForMemory(parser->data, parser->size, "/", NULL, XML_PARSE_NONET | XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_NOCDATA); if (!parser->reader) { smlErrorSet(error, SML_ERROR_GENERIC, "Unable to create new reader"); @@ -1924,6 +1925,7 @@ error_free_reader: xmlFreeTextReader(parser->reader); + smlLibxmlUnref(); error: parser->reader = NULL; if (parser->data) @@ -1983,6 +1985,7 @@ goto error; xmlFreeTextReader(parser->reader); + smlLibxmlUnref(); parser->reader = NULL; parser->size = 0; smlSafeCFree(&(parser->data)); @@ -2000,13 +2003,13 @@ smlTrace(TRACE_ENTRY, "%s(%p)", __func__, parser); smlAssert(parser); - if (parser->reader) + if (parser->reader) { xmlFreeTextReader(parser->reader); + smlLibxmlUnref(); + } if (parser->data) smlSafeCFree(&(parser->data)); - //xmlCleanupParser(); - smlSafeFree((gpointer *)&parser); smlTrace(TRACE_EXIT, "%s", __func__); @@ -3277,6 +3280,7 @@ goto error; /* Create the new parser */ + smlLibxmlRef(); parser->reader = xmlReaderForMemory(data, size, "/", NULL, XML_PARSE_NONET | XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_NOCDATA | XML_PARSER_SUBST_ENTITIES); if (!parser->reader) { smlErrorSet(error, SML_ERROR_GENERIC, "Unable to create new reader"); @@ -3449,6 +3453,7 @@ xmlFreeTextReader(parser->reader); parser->reader = NULL; + smlLibxmlUnref(); smlSafeFree((gpointer *)&parser); smlTrace(TRACE_EXIT, "%s", __func__); @@ -3458,6 +3463,7 @@ if (parser && parser->reader) { xmlFreeTextReader(parser->reader); parser->reader = NULL; + smlLibxmlUnref(); } if (parser) smlSafeFree((gpointer *)&parser); |
From: <svn...@op...> - 2009-02-25 15:22:31
|
Author: bellmich Date: Wed Feb 25 16:22:25 2009 New Revision: 951 URL: http://libsyncml.opensync.org/changeset/951 Log: added code to handle libxml initialization and cleanup in a thread safe way Modified: trunk/libsyncml/sml_support.c trunk/libsyncml/sml_support.h Modified: trunk/libsyncml/sml_support.c ============================================================================== --- trunk/libsyncml/sml_support.c Wed Feb 25 16:21:22 2009 (r950) +++ trunk/libsyncml/sml_support.c Wed Feb 25 16:22:25 2009 (r951) @@ -33,6 +33,8 @@ #include <string.h> #include <stdio.h> +#include <libxml/parser.h> + GPrivate* current_tabs = NULL; #define G_ERRORCHECK_MUTEXES @@ -507,4 +509,37 @@ smlSafeFree((gpointer *)address); } +static size_t __sml_libxml_ref_count = 0; +GStaticMutex __sml_libxml_mutex = G_STATIC_MUTEX_INIT; + +void smlLibxmlRef() +{ + g_static_mutex_lock(&__sml_libxml_mutex); + if (__sml_libxml_ref_count > 0) { + __sml_libxml_ref_count++; + } else if (__sml_libxml_ref_count == 0) { + __sml_libxml_ref_count++; + xmlInitParser(); + smlTrace(TRACE_INTERNAL, "%s: libxml initialized", __func__); + } + g_static_mutex_unlock(&__sml_libxml_mutex); +} + +void smlLibxmlUnref() +{ + g_static_mutex_lock(&__sml_libxml_mutex); + if (__sml_libxml_ref_count > 1) { + __sml_libxml_ref_count--; + } else if (__sml_libxml_ref_count == 1) { + __sml_libxml_ref_count--; + xmlCleanupParser(); + xmlCleanupGlobals(); + smlTrace(TRACE_INTERNAL, "%s: libxml cleaned up", __func__); + } else if (__sml_libxml_ref_count == 0) { + g_warning("libsyncml: libxml is not referenced but somebody tries to cleanup."); + smlTrace(TRACE_ERROR, "%s: reference counter is already zero.", __func__); + } + g_static_mutex_unlock(&__sml_libxml_mutex); +} + /*@}*/ Modified: trunk/libsyncml/sml_support.h ============================================================================== --- trunk/libsyncml/sml_support.h Wed Feb 25 16:21:22 2009 (r950) +++ trunk/libsyncml/sml_support.h Wed Feb 25 16:22:25 2009 (r951) @@ -66,4 +66,7 @@ void smlSafeFree(gpointer *address); void smlSafeCFree(char **address); +void smlLibxmlRef(); +void smlLibxmlUnref(); + #endif //_SML_SUPPORT_H_ |
From: <svn...@op...> - 2009-02-25 15:21:28
|
Author: bellmich Date: Wed Feb 25 16:21:22 2009 New Revision: 950 URL: http://libsyncml.opensync.org/changeset/950 Log: if there is already a transport error then following errors can be ignored Modified: trunk/libsyncml/data_sync_api/data_sync_callbacks.c Modified: trunk/libsyncml/data_sync_api/data_sync_callbacks.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_callbacks.c Wed Feb 25 16:19:24 2009 (r949) +++ trunk/libsyncml/data_sync_api/data_sync_callbacks.c Wed Feb 25 16:21:22 2009 (r950) @@ -138,6 +138,11 @@ &locerror); if (link) smlLinkDeref(link); + /* error is already tracked. + * So locerror can be ignored. + */ + if (locerror) + smlErrorDeref(&locerror); /* It is not a good idea to wait for the * disconnect here. First this is an * asynchronous software so it is always |