[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH] automation: Avoid changing source files for randconfig tests



On Wed, Mar 26, 2025 at 07:10:52PM -0700, Stefano Stabellini wrote:
> On Wed, 26 Mar 2025, Anthony PERARD wrote:
> > diff --git a/automation/scripts/build b/automation/scripts/build
> > index 522efe774e..8a3b8fb6b2 100755
> > --- a/automation/scripts/build
> > +++ b/automation/scripts/build
> > @@ -12,12 +12,12 @@ $cc --version
> >  # random config or default config
> >  if [[ "${RANDCONFIG}" == "y" ]]; then
> >  
> > -    # Append job-specific fixed configuration
> > -    if [[ -n "${EXTRA_FIXED_RANDCONFIG}" ]]; then
> > -        echo "${EXTRA_FIXED_RANDCONFIG}" >> 
> > xen/tools/kconfig/allrandom.config
> > -    fi
> > +    cp -f xen/tools/kconfig/allrandom.config xen/allrandom.config.tmp
> 
> Wouldn't it be better to use mktemp?
> 
> local tmpconfig=$(mktemp)

I though of it and I wasn't sure if we could use it in the CI, but it's
already been used so that's an option. (Actually, there's only a single
use by ./check-endbr.sh, ./configure does use it as well but to create
temporary directory within the build tree.)

But, to avoid overflowing /tmp with loads of leftover temporary files,
we need to clean it, with:

    trap "rm $tmpconfig" EXIT

The advantage of using an in-tree files with a predefined name is that
it isn't going to create more than one file, no matter how many time you
run ./build. The '*.tmp' files are already ignored by our .gitignore. I
could rename it to with a "." to hide it a bit more.

Thanks,

-- 

Anthony Perard | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.