There are several things here that can go wrong:
Are /var/trac/test
and /var/svn/test
files or directories? Real tar
would work fine with both; your task - the way it's written right now - would only work with files but not folders.
Do you (or, rather, does Ant process) have adequate permissions?
<include>
elements contain patterns, which are generally relative to base dir. You're specifying them as absolute.
I would rewrite the above as:
<target name="archive" depends="init">
<tar compression="gzip" destfile="test.tar.gz">
<tarfileset dir="/var/trac" prefix="/var/trac">
<include name="test/**" />
<include name="svn/**" />
</tarfileset>
</tar>
</target>
prefix
allows you to explicitly specify the path with which files in Tar archive should begin.
/**
within <include>
tells Ant to take all the files from that folder and all its subfolders. If /var/trac/test
and /var/svn/test
are indeed files and not folders then you can omit that.