Re: [libav-devel] [PATCH 1/4] fate: Add tests of the ff_make_absolute_url function
On Sat, Oct 06, 2012 at 10:39:51AM +0100, Måns Rullgård wrote: > Diego Biurrun writes: > > On Sat, Oct 06, 2012 at 02:44:41AM +0300, Martin Storsjö wrote: > >> On Sat, 6 Oct 2012, Diego Biurrun wrote: > >> >On Sat, Oct 06, 2012 at 02:05:21AM +0300, Martin Storsjö wrote: > >> >>--- /dev/null > >> >>+++ b/libavformat/url-test.c > >> >>@@ -0,0 +1,55 @@ > >> >>+/* > >> >>+ * Copyright (c) 2012 Martin Storsjo > >> > > >> >No 'ö'? > >> > >> I prefer keeping the source files plain ascii as long as my name is > >> the only thing that would require utf8. > > > > Aren't we modern enough to have UTF-8 in sources nowadays? > > It's safer to not use it. If you'd seen what I have you'd be avoiding > it too. "If you'd seen what I'd seen..." <--- priceless quote :) Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/4] fate: Add tests of the ff_make_absolute_url function
Diego Biurrun writes: > On Sat, Oct 06, 2012 at 02:44:41AM +0300, Martin Storsjö wrote: >> On Sat, 6 Oct 2012, Diego Biurrun wrote: >> >On Sat, Oct 06, 2012 at 02:05:21AM +0300, Martin Storsjö wrote: >> >>--- /dev/null >> >>+++ b/libavformat/url-test.c >> >>@@ -0,0 +1,55 @@ >> >>+/* >> >>+ * Copyright (c) 2012 Martin Storsjo >> > >> >No 'ö'? >> >> I prefer keeping the source files plain ascii as long as my name is >> the only thing that would require utf8. > > Aren't we modern enough to have UTF-8 in sources nowadays? It's safer to not use it. If you'd seen what I have you'd be avoiding it too. -- Måns Rullgård m...@mansr.com ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/4] fate: Add tests of the ff_make_absolute_url function
On Sat, Oct 06, 2012 at 02:44:41AM +0300, Martin Storsjö wrote: > On Sat, 6 Oct 2012, Diego Biurrun wrote: > >On Sat, Oct 06, 2012 at 02:05:21AM +0300, Martin Storsjö wrote: > >>--- /dev/null > >>+++ b/libavformat/url-test.c > >>@@ -0,0 +1,55 @@ > >>+/* > >>+ * Copyright (c) 2012 Martin Storsjo > > > >No 'ö'? > > I prefer keeping the source files plain ascii as long as my name is > the only thing that would require utf8. Aren't we modern enough to have UTF-8 in sources nowadays? > >>--- /dev/null > >>+++ b/tests/ref/fate/url > >>@@ -0,0 +1,10 @@ > >>+baz > >>+/foo/baz > >>+/baz > >>+/baz > >>+http://server/foo/baz > >>+http://server/foo/baz > >>+http://server/baz > >>+http://server/baz > >>+http://server/baz > >>+https://other/url > > > >I'd suggest that you move this patch to the end of the series so that > >you don't have to make small changes to the test program in every > >revision. But do whatever you prefer. > > Maybe, but adding them incrementally is slightly clearer about which > feature addition is tested by which commit. But I'm ok with it > either way if others prefer it one way or another as well. By all means keep it if you prefer. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/4] fate: Add tests of the ff_make_absolute_url function
On Sat, 6 Oct 2012, Diego Biurrun wrote: On Sat, Oct 06, 2012 at 02:05:21AM +0300, Martin Storsjö wrote: --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -376,7 +376,7 @@ SKIPHEADERS-$(CONFIG_NETWORK)+= network.h rtsp.h EXAMPLES = metadata\ output \ -TESTPROGS = seek +TESTPROGS = seek url Break the line, like above. Fixed locally --- a/tests/Makefile +++ b/tests/Makefile @@ -86,6 +87,7 @@ FATE_SAMPLES-$(CONFIG_AVCONV) += $(FATE_SAMPLES_AVCONV) FATE += $(FATE-yes) +FATE += $(FATE_LIBAVFORMAT) FATE += $(FATE_LIBAVUTIL) avformat can be disabled, so add this conditionally, similar to avcodec above. Fixed locally --- /dev/null +++ b/libavformat/url-test.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2012 Martin Storsjo No 'ö'? I prefer keeping the source files plain ascii as long as my name is the only thing that would require utf8. +#include "internal.h" + +#undef printf +#undef exit + +static void test(const char *base, const char *rel) +{ +char buf[200], buf2[200]; +ff_make_absolute_url(buf, sizeof(buf), base, rel); +printf("%s\n", buf); +if (base) { +/* Test in-buffer replacement */ +snprintf(buf2, sizeof(buf2), "%s", base); +ff_make_absolute_url(buf2, sizeof(buf2), buf2, rel); +if (strcmp(buf, buf2)) { +printf("In-place handling of %s + %s failed\n", base, rel); +exit(1); +} +} +} + +int main(int argc, char **argv) +{ +test(NULL, "baz"); +test("/foo/bar", "baz"); +test("/foo/bar", "../baz"); +test("/foo/bar", "/baz"); +test("http://server/foo/";, "baz"); +test("http://server/foo/bar";, "baz"); +test("http://server/foo/";, "../baz"); +test("http://server/foo/bar/123";, "../../baz"); +test("http://server/foo/bar/123";, "/baz"); +test("http://server/foo/bar/123";, "https://other/url";); +return 0; +} --- /dev/null +++ b/tests/ref/fate/url @@ -0,0 +1,10 @@ +baz +/foo/baz +/baz +/baz +http://server/foo/baz +http://server/foo/baz +http://server/baz +http://server/baz +http://server/baz +https://other/url I'd suggest that you move this patch to the end of the series so that you don't have to make small changes to the test program in every revision. But do whatever you prefer. Maybe, but adding them incrementally is slightly clearer about which feature addition is tested by which commit. But I'm ok with it either way if others prefer it one way or another as well. // Martin___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/4] fate: Add tests of the ff_make_absolute_url function
On Sat, Oct 06, 2012 at 02:05:21AM +0300, Martin Storsjö wrote: > --- a/libavformat/Makefile > +++ b/libavformat/Makefile > @@ -376,7 +376,7 @@ SKIPHEADERS-$(CONFIG_NETWORK)+= network.h > rtsp.h > EXAMPLES = metadata\ > output \ > > -TESTPROGS = seek > +TESTPROGS = seek url Break the line, like above. > --- a/tests/Makefile > +++ b/tests/Makefile > @@ -86,6 +87,7 @@ FATE_SAMPLES-$(CONFIG_AVCONV) += $(FATE_SAMPLES_AVCONV) > > FATE += $(FATE-yes) > +FATE += $(FATE_LIBAVFORMAT) > FATE += $(FATE_LIBAVUTIL) avformat can be disabled, so add this conditionally, similar to avcodec above. > --- /dev/null > +++ b/libavformat/url-test.c > @@ -0,0 +1,55 @@ > +/* > + * Copyright (c) 2012 Martin Storsjo No 'ö'? > +#include "internal.h" > + > +#undef printf > +#undef exit > + > +static void test(const char *base, const char *rel) > +{ > +char buf[200], buf2[200]; > +ff_make_absolute_url(buf, sizeof(buf), base, rel); > +printf("%s\n", buf); > +if (base) { > +/* Test in-buffer replacement */ > +snprintf(buf2, sizeof(buf2), "%s", base); > +ff_make_absolute_url(buf2, sizeof(buf2), buf2, rel); > +if (strcmp(buf, buf2)) { > +printf("In-place handling of %s + %s failed\n", base, rel); > +exit(1); > +} > +} > +} > + > +int main(int argc, char **argv) > +{ > +test(NULL, "baz"); > +test("/foo/bar", "baz"); > +test("/foo/bar", "../baz"); > +test("/foo/bar", "/baz"); > +test("http://server/foo/";, "baz"); > +test("http://server/foo/bar";, "baz"); > +test("http://server/foo/";, "../baz"); > +test("http://server/foo/bar/123";, "../../baz"); > +test("http://server/foo/bar/123";, "/baz"); > +test("http://server/foo/bar/123";, "https://other/url";); > +return 0; > +} > --- /dev/null > +++ b/tests/ref/fate/url > @@ -0,0 +1,10 @@ > +baz > +/foo/baz > +/baz > +/baz > +http://server/foo/baz > +http://server/foo/baz > +http://server/baz > +http://server/baz > +http://server/baz > +https://other/url I'd suggest that you move this patch to the end of the series so that you don't have to make small changes to the test program in every revision. But do whatever you prefer. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel