Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change meson target configs #81

Merged
merged 1 commit into from
Jul 6, 2024
Merged

Change meson target configs #81

merged 1 commit into from
Jul 6, 2024

Conversation

viega
Copy link
Contributor

@viega viega commented Jul 5, 2024

Changed the meson build targets so that:

  1. The debug target does NOT turn on ASAN / UBSAN by default (the noise was slowing down debugging a lot). This does have our own internal memory checking enabled though.
  2. There's a new 'cicd' target that additionally enables ASAN / UBSAN. It's accessible via dev testbuild

CI/CD config is set up to use the second of these.

@viega viega requested a review from ee7 July 5, 2024 21:07
@viega viega marked this pull request as ready for review July 5, 2024 21:07
@viega viega changed the title Changed the meson build targets so that: Remove ASAN / UBSan from debug; add it to CI/CD Jul 5, 2024
Copy link
Contributor

@ee7 ee7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understood the PR description as "CI now runs with ASan and UBSan", and that sounds good to me. But that's not currently happening, right?

I'd also expect some errors in the logs if the sanitizers were running. For example, from #56, when UBSan is enabled I think we'd want to add to the c_args:

-fno-sanitize=function

dev Show resolved Hide resolved
dev Outdated Show resolved Hide resolved
meson.build Outdated Show resolved Hide resolved
@viega viega force-pushed the jtv/meson_targets branch from e73ccf4 to e5b39ba Compare July 6, 2024 02:11
@viega
Copy link
Contributor Author

viega commented Jul 6, 2024

Something weird has happened to the Mac runner; it no longer finds libffi. @ee7 lmk if you see what might be the issue on that.

@ee7
Copy link
Contributor

ee7 commented Jul 6, 2024

The below diff to 7db4669 makes the macOS build work again. Does that help?

-function meson_init_target {
+function meson_build {
+
+    echo ${1} > .meson_last
+    rm deps/local 2>/dev/null
+    ln -s ${PWD}/deps/${OS}-${ARCH} ${PWD}/deps/local
+
+
     if [[ ! -d ${1} ]]; then
         if [[ -f ${1} ]]; then
             rm -rf ${1}
@@ -41,16 +47,7 @@ function meson_init_target {
         log meson setup ${@}
         meson setup ${@}
     fi
-}
 
-function meson_build {
-
-    echo ${1} > .meson_last
-    rm deps/local 2>/dev/null
-    ln -s ${PWD}/deps/${OS}-${ARCH} ${PWD}/deps/local
-
-
-    meson_init_target ${@}
     cd ${1}
 
     log Compiling meson target ${1}
@@ -187,9 +184,7 @@ case $1 in
              meson_build debug
              debug_it
              ;;
-    testbuild)   meson_init_target cicd --buildtype=debug
-                 meson configure cicd -Duse_memcheck=true
-                 meson_build cicd
+    testbuild)   meson_build cicd --buildtype=debug
                  ;;

1. The debug target does NOT turn on ASAN / UBSAN by default (the noise was slowing down debugging a lot). This *does* have our own internal memory checking enabled though.
2. There's a new 'cicd' target. It's accessible via `dev testbuild`
3. There's a separate target for enabling ASAN/UBSAN. That's not guaranteed to give good results.

CI/CD config is set up to use #2.
@viega viega force-pushed the jtv/meson_targets branch from 7db4669 to b7d6c93 Compare July 6, 2024 11:46
@viega
Copy link
Contributor Author

viega commented Jul 6, 2024

Was helpful @ee7, thanks. Passing now.

Copy link
Contributor

@ee7 ee7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with a couple of non-blocking questions from before.

Nit for merging: For the merged commit title, can we avoid using the current PR title as-is? I would understand

Remove ASAN / UBSan from debug; add it to CI/CD

as "CI now uses ASan and UBSan", but that won't be the case.

Comment on lines 75 to +80
c_args = c_args + ['-fsanitize=undefined',
'-fsanitize-recover=all'
]
'-fsanitize-recover=all'
]
link_args = link_args + ['-fsanitize=undefined',
'-fsanitize-recover=all'
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Indentation-wise, I was referring to the start of line 78, not the horizontal alignment of lines 79 and 80. But my understanding is the next minor meson release (1.5.0) will include a meson format command anyway.

dev
@@ -162,7 +158,7 @@ function libcon4m_run_tests {
}

function libcon4m_dev_clean {
for item in build debug release; do
for item in build debug release cicd .meson_last; do
if [[ -d ${item} ]]; then
Copy link
Contributor

@ee7 ee7 Jul 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: .meson_last in the line above still looks strange to me.

Doesn't that always do nothing, because .meson.last is a file? Is the intention to read the contents of .meson.last, like TARGET elsewhere in this file?

@viega viega changed the title Remove ASAN / UBSan from debug; add it to CI/CD Change meson target configs Jul 6, 2024
@viega viega merged commit 325597b into main Jul 6, 2024
3 checks passed
@viega viega deleted the jtv/meson_targets branch July 6, 2024 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants